Skip to content

Instantly share code, notes, and snippets.

View scheibo's full-sized avatar

Kirk Scheibelhut scheibo

View GitHub Profile
@scheibo
scheibo / rvm
Created February 12, 2011 03:08
can't access rvm from non root user despite being in the rvm group
root@scheibo# type rvm | head -1
rvm is a function
root@scheibo# rvm list
rvm rubies
ruby-1.8.7-p330 [ x86_64 ]
=> ruby-1.9.2-p136 [ x86_64 ]
root@scheibo# ruby -v
int qsort_cmp ( const void * elem1, const void * elem2 ) {
int y_diff = (*(Point **)elem1)->y() - (*(Point **)elem2)->y();
return (y_diff != 0 ? y_diff : (*(Point **)elem1)->x() - (*(Point **)elem2)->x() );
}
vector< Point* > points(n,NULL);
qsort(&points[0] , n, sizeof(Point*), qsort_cmp );
11 minutes ago · Like ·
@scheibo
scheibo / v-features.md
Created May 22, 2011 19:33
features of the v editor

no scripting language.

up/down (line) - jk forward/back (char, word) -hl,bw open line before/after (O/o) goto (nnnG, :nnn, gg) beginning/end of line (0^, $)

copy, cut, paste undo, redo

set grepprg=git\ grep\ -n
//line 1647 xdraws
if(base.mode & ATTR_REVERSE)
if (base.mode & ATTR_BOLD)
xfg = dc.col[base.bg+8], xbg = dc.col[base.fg];
else
xfg = dc.col[base.bg], xbg = dc.col[base.fg];
else
if (base.mode & ATTR_BOLD)
xfg = dc.col[base.fg+8], xbg = dc.col[base.bg];
@scheibo
scheibo / commands
Created June 24, 2011 03:40
v commands
# v commands
## Addressing
All of these matches are dependent on the context in which they are used. The default is line granularity, unless they are used in a compound expression or have a literal '#' placed in front of them. For example, .,5 means from the current line to the 5th line. .,#5 means the same as #.,#5 from the current character (context of the second arg changes its meaning) to the 5th character. #.,5 means from the current character to the 5th line. Note this means that (0,$ == #0,$ == 0,#$ == 1,$ == 1,#$) != #1,$.
. - The current address. In ed this is the current line and in sam this is the 'dot' (character granularity). In the command language, this depends on the context.
$ - The null string at the end of the file (sam) or the last line in the buffer (ed), depending on context.
@scheibo
scheibo / gist:1190410
Created September 3, 2011 02:07
dyld error message
dyld: lazy symbol binding failed: Symbol not found: _rb_define_singleton_function
Referenced from: /Users/kjs/Code/src/dat/lib/logic.bundle
Expected in: flat namespace
dyld: Symbol not found: _rb_define_singleton_function
Referenced from: /Users/kjs/Code/src/dat/lib/logic.bundle
Expected in: flat namespace
Trace/BPT trap: 5
@scheibo
scheibo / command line
Created September 4, 2011 15:31
valgrind config.log
kjs@scheibo(master)$ brew install valgrind
==> Downloading http://valgrind.org/downloads/valgrind-3.6.1.tar.bz2
File already downloaded in /Users/kjs/Library/Caches/Homebrew
==> Downloading patches
==> Patching
patching file coregrind/fixup_macho_loadcmds.c
patching file coregrind/link_tool_exe_darwin.in
patching file coregrind/Makefile.am
Hunk #1 succeeded at 437 (offset -4 lines).
==> autoreconf -ivf
@scheibo
scheibo / gist:1267911
Created October 6, 2011 16:47
output
t.o threadtest.o tt3.o synchtest.o malloctest.o fstest.o autoconf.o vers.o -o kernel
cs350-size kernel
text data bss dec hex filename
172440 480 7784 180704 2c1e0 kernel
[ -d /u2/kjmscheibelhut/cs350-os161/root ] || mkdir /u2/kjmscheibelhut/cs350-os161/root
cp kernel /u2/kjmscheibelhut/cs350-os161/root/kernel-ASST1
rm -f /u2/kjmscheibelhut/cs350-os161/root/kernel
ln -s kernel-ASST1 /u2/kjmscheibelhut/cs350-os161/root/kernel
1%>linux028:~/cs350-os161/os161-1.11> cd ../root/
1%>linux028:~/cs350-os161/root> sys161 -w kernel
#!/usr/bin/env ruby
def rand_float
sprintf("%.1f", rand * 10 * (rand > 0.5 ? 1 : -1).to_f)
end
num = ARGV[0]
radius = ARGV[1]
diameter = ARGV[2]