This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env rvm 1.9.3 do ruby | |
require 'pp' | |
def hamming(i) | |
dist = 0 | |
v = i | |
while v != 0 | |
dist += 1 if (v & 1 != 0) | |
v >>= 1 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./httpfs2-mt http://eventdata.psu.edu/data.dir/GDELT.1979-2012.reduced.zip mnt | |
file name: GDELT.1979-2012.reduced.zip | |
host name: eventdata.psu.edu | |
port number: 80 | |
protocol: http | |
request path: /data.dir/GDELT.1979-2012.reduced.zip | |
auth data: (null) | |
./httpfs2-mt: HEAD: invalid time | |
Wed, 03 Apr 2013 05:14:40 GMT | |
file size: 667748833 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vasi@inchon:~/Downloads$ LIBGUESTFS_PATH=$PWD/rwmj-appliance guestfish -a ubuntu-10.04.4-alternate-amd64.iso | |
Welcome to guestfish, the libguestfs filesystem interactive shell for | |
editing virtual machine filesystems. | |
Type: 'help' for help on commands | |
'man' to read the manual | |
'quit' to quit the shell | |
><fs> run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define BOM 0xFEFF | |
#define SUR1 0xD800 | |
#define SUR2 0xDC00 | |
int read16(void) { | |
int a = getc(stdin), b = getc(stdin); | |
if (a == EOF || b == EOF) | |
return EOF; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define BOM 0xFEFF | |
#define SUR1 0xD800 | |
#define SUR2 0xDC00 | |
int read16(void) { | |
int a = getc(stdin), b = getc(stdin); | |
if (a == EOF || b == EOF) | |
return EOF; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: usr.sbin/ndiscvt/inf-token.l | |
=================================================================== | |
--- usr.sbin/ndiscvt/inf-token.l (revision 251347) | |
+++ usr.sbin/ndiscvt/inf-token.l (working copy) | |
@@ -55,6 +55,9 @@ | |
lineno++; | |
} | |
+static void in_buf(char *buf, yy_size_t *result, int max_size); | |
+#define YY_INPUT(buf, result, max_size) (in_buf(buf, &result, max_size)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Olio:~/Desktop/mefi] vasi$ cd ..; rm -r mefi; clear | |
override r--r--r-- vasi/staff for mefi/.git/objects/25/7cc5642cb1a054f08cc83f2d943e56fd3ebe99? ^C | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Olio:~/Desktop] vasi$ git init mefi | |
Initialized empty Git repository in /Users/vasi/Desktop/mefi/.git/ | |
[Olio:~/Desktop] vasi$ cd mefi | |
[Olio:~/Desktop/mefi] vasi$ # Create some files and commit them | |
[Olio:~/Desktop/mefi] vasi$ for i in foo bar iggy blah; do echo $i > $i; done | |
[Olio:~/Desktop/mefi] vasi$ ls | |
bar blah foo iggy | |
[Olio:~/Desktop/mefi] vasi$ cat iggy | |
iggy | |
[Olio:~/Desktop/mefi] vasi$ git add * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
= LinuxFromScratch using Mac OS X = | |
Linux From Scratch is a fun way to learn about Linux, but it expects you to already have Linux running. [http://trac.cross-lfs.org Cross-compiling] is already supported but OS X is a little weird--so here are some hints for bootstrapping LFS from OS X. I've only tried this on 32-bit PPC, I have no idea how well or badly it would work on G5 or Intel chips. | |
Generally, you can follow the [http://cross-lfs.org/view/1.0.0rc4/ppc/ Cross-LFS book], I only refer to areas where changes are needed. | |
== Chapter 2 == | |
=== Partitioning === | |
To perform the partitioning, you'll probably want to use a Linux rescue CD. Gentoo's PPC CD has a version of parted that can even resize existing HFS+ partitions non-destructively, I think Debian's does too. Using Disk Utility or a commercial tool like iPartition is an option, but I'm not certain they can create the special partition types Apple_Bootstrap and Apple_UNIX_SVR2. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# First arg is always option | |
arg1="$1" | |
shift | |
# Find first non-option | |
for i in "$@"; do | |
if [[ -z "$dir" && "$i" != -* ]]; then | |
dir="$i" |