Skip to content

Instantly share code, notes, and snippets.

Jarrell Waggoner malloc47

Block or report user

Report or block malloc47

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
malloc47 / command line
Created Apr 7, 2012 — forked from paraboul/command line
JavaScript + C Preprocessor
View command line
/usr/bin/cpp -P -undef -Wundef -std=c99 -nostdinc -Wtrigraphs -fdollars-in-identifiers -C < foo.js
malloc47 /
Created Feb 18, 2012
create page of +1s
echo "<html><head>" > page.html
echo "<script type=\"text/javascript\" src=\"\"></script>" >> page.html
echo "</head><body>" >> page.html
grep -o http[^\"\)\']* $1 | xargs -I{} echo "<g:plusone href=\"{}\"></g:plusone>" >> page.html
echo "</body></html>" >> page.html
View ladder1.cog
surface downsect
message activated
thing ghosttel1
thing ghosttel2
thing player local
surface upsuf1
malloc47 /
Created Feb 11, 2012
embedly challenge
# Problem 1
fact = lambda n: reduce(lambda x,y: x*y, range(1, n+1), 1)
convert = lambda n: sum(map(int,str(n)))
def p1gen():
i = 0
while True:
yield (i,convert(fact(i)))
malloc47 / gist:1742772
Created Feb 5, 2012
find all git repositories and print info about them
View gist:1742772
# requires git alias
# s = status -s -uno
for i in `find ~/ -type d -name .git` ; do echo $i ; builtin cd $i/../ ; git s ; builtin cd ~/ ; done
malloc47 / git-chop
Created Feb 5, 2012
Git Chopping and Cropping
View git-chop
# remove a file or directory
set -e
if [ $# -lt $EXPECTED_ARGS ]
echo "Usage: `basename $0` [directory]"
malloc47 / ls_d.cpp
Created Oct 30, 2011
listing files with posix C calls
View ls_d.cpp
// Lists directories in the given path
list_t ls_d(string path) {
list_t output;
DIR* dirp = opendir(path.c_str());
struct dirent *file;
return list_t();
while ((file = readdir(dirp)) != NULL) {
string name(file->d_name);
if(!".") || !"..")) continue;
malloc47 / man-flesch
Created Oct 25, 2011
Flesch–Kincaid Index For *nix Man Pages
View man-flesch
# prepossess: remove newlines, add newlines after end of sentences, trim whitespace, and remove short lines
man /usr/share/man/man1/git.1.gz | tr '\n' ' ' | sed 's/\./\.\n/g' | sed -e 's/^[ \t]*//' | sed '/.\{3\}/!d'
You can’t perform that action at this time.