Skip to content

Instantly share code, notes, and snippets.

View davidbalbert's full-sized avatar

David Albert davidbalbert

View GitHub Profile
quine.rb:1: syntax error, unexpected tINTEGER, expecting tSTRING_CONTENT or tSTRING_DBEG or tSTRING_DVAR or tSTRING_END
quine.rb:1: syntax error, unexpected tI...
^
@davidbalbert
davidbalbert / gist:2473779
Created April 23, 2012 20:53
Generate a python error quine
ganymede:~/Development/error-quine-generator [master]$ ruby error-quine-generator.rb python
File "/tmp/quine.py", line 1
File "/tmp/quine.py", line 1
^
IndentationError: unexpected indent
ganymede:~/Development/error-quine-generator [master]$ cat /tmp/quine.py
File "/tmp/quine.py", line 1
File "/tmp/quine.py", line 1
^
IndentationError: unexpected indent
require 'hello'
require 'goodbye'
@davidbalbert
davidbalbert / bug.rb
Created June 22, 2012 16:29
Ruby inner method visibility bug
def foo
def bar
end
end
foo
p Object.instance_methods(false)
p Object.private_instance_methods(false)
#!/bin/sh
make clean
make distclean
rm -rf ./build
set -e
autoconf || exit 125
(./configure --prefix=`pwd`/build/ && make && make install) || exit 125
tell application "Terminal"
activate
tell application "System Events" to keystroke "n" using command down
end tell
class Polygon
@@sides = nil
def self.sides
@@sides
end
def self.count
@@count
end
ganymede:~/Development/ruby [trunk]$ brew link --verbose apple-gcc42
Linking /usr/local/Cellar/apple-gcc42/4.2.1-5666.3... ln -s ../Cellar/apple-gcc42/4.2.1-5666.3/bin/i686-apple-darwin11-gfortran-4.2.1 i686-apple-darwin11-gfortran-4.2.1
ln -s ../Cellar/apple-gcc42/4.2.1-5666.3/bin/i686-apple-darwin11-gcc-4.2.1 i686-apple-darwin11-gcc-4.2.1
ln -s ../Cellar/apple-gcc42/4.2.1-5666.3/bin/i686-apple-darwin11-g++-4.2.1 i686-apple-darwin11-g++-4.2.1
ln -s ../Cellar/apple-gcc42/4.2.1-5666.3/bin/i686-apple-darwin11-cpp-4.2.1 i686-apple-darwin11-cpp-4.2.1
ln -s ../Cellar/apple-gcc42/4.2.1-5666.3/bin/gfortran-4.2 gfortran-4.2
ln -s ../Cellar/apple-gcc42/4.2.1-5666.3/bin/gfortran gfortran
ln -s ../Cellar/apple-gcc42/4.2.1-5666.3/bin/gcov-4.2 gcov-4.2
ln -s ../Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2 gcc-4.2
ln -s ../Cellar/apple-gcc42/4.2.1-5666.3/bin/g++-4.2 g++-4.2
@davidbalbert
davidbalbert / README.md
Created September 12, 2012 16:41
Clang code generation

When I compile hello.c with: clang -g -O0 hello.c -o hello, and disassemble it in GDB, I get the contents of hello.s.

The line that confuses me is . It seems that when optimizations are off, clang saves unused return values on the stack. is saving the return value of printf even though hello.c doesn't do anything with it at all. I assume there's a reason for this. Why does it happen?

@davidbalbert
davidbalbert / after_patch
Created November 20, 2012 19:09
BFD test results
$ make check
make check-recursive
Making check in doc
make[4]: Nothing to be done for `check'.
Making check in po
file=`echo ../../../bfd/po/da | sed 's,.*/,,'`.gmo \
&& rm -f $file && PATH=../src:$PATH : -o $file ../../../bfd/po/da.po
file=`echo ../../../bfd/po/es | sed 's,.*/,,'`.gmo \
&& rm -f $file && PATH=../src:$PATH : -o $file ../../../bfd/po/es.po
file=`echo ../../../bfd/po/fi | sed 's,.*/,,'`.gmo \