This file contains hidden or 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
#!/bin/sh -ex | |
# Read an python class file and extraact the attributes | |
# from the constructor. Then assign them and creates setters | |
PYTHON_CLASS_FILE=${1} | |
get_constructor_definition=$(sed -n '/__init__(self,/,/):/p' ${PYTHON_CLASS_FILE} | tr -s ' ') | |
get_mandatory_attributes=$(echo ${get_constructor_definition} | sed 's/def\|__init__\|self//g' | sed 's/, /\n/g' | tr -d ' (,):' | grep -v '=None') | |
get_optional_attributes=$(echo ${get_constructor_definition} | sed 's/def\|__init__\|self//g' | sed 's/, /\n/g' | tr -d ' (,):' | grep '=None' | cut -d '=' -f 1) |
This file contains hidden or 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 python | |
# Convert a mysql dump into a sqlite-compatible format. | |
# I wrote this for just one script... no guarantess that it will work with others... | |
# python fsql.py < mysqldump.sql > readyforsqlite.sql | |
import re | |
import sys | |
content = sys.stdin.read() |
This file contains hidden or 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
#!/bin/sh | |
# Decompile a jar file and create a compressed | |
# file with the sources. | |
# The [JAD decompiler](http://varaneckas.com/jad/) | |
# is used. | |
if [ $# -eq 0 ]; then | |
echo "Usage: $0 [jar]" | |
exit 1 | |
fi |
This file contains hidden or 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
#!/bin/sh -ex | |
# Convert a subversion repo to git | |
# according to this link http://john.albin.net/git/convert-subversion-to-git | |
if [ $# -eq 0 ]; then | |
echo "Usage: $0 [svn repo url]" | |
exit 1 | |
fi | |
# Checkout an svn repo |
This file contains hidden or 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/python | |
import numpy | |
import pyaudio | |
import re | |
import sys | |
WIDTH = 79 | |
BOOST = 1.0 |
This file contains hidden or 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
$ cat noexit.sh | |
#!/bin/sh | |
seq 100 | while read; do exit; done # If `exit' terminated the script .. | |
echo 'Still alive!' # .. this message would not be printed. | |
$ | |
$ sh noexit.sh | |
Still alive! |
This file contains hidden or 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
// Just before switching jobs: | |
// Add one of these. | |
// Preferably into the same commit where you do a large merge. | |
// | |
// This started as a tweet with a joke of "C++ pro-tip: #define private public", | |
// and then it quickly escalated into more and more evil suggestions. | |
// I've tried to capture interesting suggestions here. | |
// | |
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_, | |
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant, |
This file contains hidden or 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
all: odometer_alphabet | |
odometer_alphabet: odometer_alphabet.c | |
gcc -o odometer_alphabet -O2 -Wall -W -ansi -pedantic -std=gnu99 odometer_alphabet.c | |
clean: | |
rm -rf odometer_alphabet |
This file contains hidden or 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
#!/bin/sh -ex | |
mkdir -p sysroot | |
PREFIX_DIR=$(readlink -e sysroot) | |
mkdir -p $PREFIX_DIR/include | |
INCLUDE_DIR=$(readlink -e $PREFIX_DIR/include/) | |
mkdir -p $PREFIX_DIR/lib | |
LIB_DIR=$(readlink -e $PREFIX_DIR/lib/) | |
mkdir -p $LIB_DIR/pkgconfig | |
PKG_CONFIG_PATH=$(readlink -e $LIB_DIR/pkgconfig/) |
This file contains hidden or 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
# Hello, and welcome to makefile basics. | |
# | |
# You will learn why `make` is so great, and why, despite its "weird" syntax, | |
# it is actually a highly expressive, efficient, and powerful way to build | |
# programs. | |
# | |
# Once you're done here, go to | |
# http://www.gnu.org/software/make/manual/make.html | |
# to learn SOOOO much more. |