Skip to content

Compiling glib-2.34.3 on Mac OSX

I loaded the development app on the mac.

I tried to configure glib-2.34.3, but it required gettext. So, I got gettext. The only problem I has was the file stpncpy.c had a weak_alias macro that allowed stpncpy.c to declare a function. However, since Mac already had that function, there was a problem. I had to define weak_alias in that file:

#define weak_alias(a,b) /* */

Of course, the right way to do this would be to check if stpncpy.c is defined. The test failed on bash. Everything else passed.

On to the build of glib2.

I had to define export LIBFFI_LIBS=-lffi and export LIBFFI-CFLAGS=-I/usr/include/ffi

Then, config did not put these values into the make file so I had to invoke make with “-e” option.

The package I wanted to compile needed pkg-config, so I went to http://www.freedesktop.org/wiki/Software/pkg-config to get it. I needed to put in the variables from /usr/local/lib/pkgconfig/glib-2.0.pc from Libs: and Cflags: as
GLIB_LIBS="-L/usr/local/lib -lglib-2.0 -lintl"
GLIB_CFLAGS="-I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include"

Wipe USB partitions

It often happens that after dd or win32image an ISO to a USB drive, it makes partitions much smaller than the drive itself. Here are some steps to wipe out those partitions and start over:

  1. Run an elevated command prompt (shift-right click run as adminstrator)
  2. run diskpart
  3. list disk
  4. Find your drive (look for size)
  5. select disk #
  6. list partition
  7. select partition #
  8. Either
    • clean
    • or delete partition (override)
  9. create partition primary
  10. (optional)convert mbr
  11. select partition 1
  12. active
  13. format fs=exFAT quick
  14. (optional) assign

Linux UPS apc back-ups

Here is how to get Linux to talk to a APC UPS via USB port.

sudo apt-get install apcupsd

Modify /etc/apcupsd/apcupsd.conf

Input method
UPSCABLE usb

Set device to usb (Leave DEVICE blank)
UPSTYPE usb
DEVICE

Modify /etc/default/apcupsd
set ISCONFIGURED to yes

sudo service apcupsd start
apcaccess

Windows 10 remove upgrade reminder

To remove the “windows 10” upgrade notification, uninstall KB3035583. Then hide the KB3035583 so it does not get installed again.

 

Simple brute force duplicate file identification

Here is a way to identify files that have duplicates.

find dir -type f -print0 | xargs -0 md5sum > filelist.txt
sort filelist.txt > filesort.txt
uniq -w 33 -D filesort.txt

# more legible
uniq -w 33 --all-repeated=separate filesort.txt # also --all-rep=sep works

This will show which files have duplicates. I saved the results in a file instead of piping everything so one can go back to filesort.txt and identify the other files which have the same md5.

Make sure you actually compare the files. Some files could possibly have the same md5sum without being the same. They will likely have a different size. It is possible for two files of the same size to have the same md5sum.For better positive hits, use sha256 (slower).

Crash dump anaylsis

Here is how to analyze a kernel crash dump in CentOs

First, to install vmlinux with debugging symbols

strings /var/crash/127.0.0.1-2013-06-22-18\:15\:01/vmcore | less

Look for the kernel version. In this case:

OSRELEASE=2.6.32-220.el6.x86_64

Go to

http://debuginfo.centos.org/6/x86_64/ and download
kernel-debuginfo-2.6.32-220.el6.x86_64.rpm  and
kernel-debuginfo-common-x86_64-2.6.32-220.el6.x86_64.rpm

Install on target machine with

rpm -ivh kernel-debuginfo-common-x86_64-2.6.32-220.el6.x86_64.rpm
rpm -ivh kernel-debuginfo-2.6.32-220.el6.x86_64.rpm

Finally, the crash dump analysis:

  crash /usr/lib/debug/lib/modules/2.6.32-220.el6.x86_64/vmlinux ./vmcore


Use the “bt” command to pull up a backtrace. It will tell you what program was running and what happened to cause the crash.

robocopy hints

rem robocopy options
rem /dst ::daylight savings time adjustment
rem /R:20 :: retry 20 times (30 seconds between tries)
rem /e    :: copy subdirectories including empties.
rem /XO :: exclude older files
rem /mov (remove from source) used for removing from ds1.
rem /purge remove dest files no longer in source


rem debugging
rem /L to test the command
rem /LOG:file :: log to file
rem /TEE      :: file and console output
rem /V        :: verbose.
rem /np       :: Don't show percentage copied

robocopy g:/source h:/dest /log:g:/source-copy.log /tee /dst /e /r:20 /xo /np
Follow

Get every new post delivered to your Inbox.