Skip to content

Instantly share code, notes, and snippets.

@febeling
febeling / com.florianebeling.rubygems.server.plist
Created December 8, 2008 20:20
Run gem server in background on OS X. save as FILE, then do "launchctl load FILE". Symlink FILE to /Library/LaunchDaemons to get it started automatically on restart
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.florianebeling.rubygems.server</string>
<key>ProgramArguments</key>
<array>
<string>/opt/local/bin/ruby</string>
<string>/opt/local/bin/gem</string>
@febeling
febeling / g
Created February 17, 2009 21:08
Google from the shell for Mac OS X
#!/bin/sh
# -*- shell-script -*-
query=""
for term in $@
do
if [[ $query ]] ; then
query+="+$term"
else
query=$term
fi
@febeling
febeling / stacktrace.hrl
Created March 19, 2009 13:40
Macros for displaying stacktrace information in erlang
-define(callstack(),
try throw(generate_stack)
catch
throw:generate_stack ->
erlang:get_stacktrace()
end).
-define(printstack(),
PrintFrame = fun({Mod, Fun, Ari}) ->
io:format(" at ~w:~w/~w~n", [Mod, Fun, Ari])
diff --git a/Rakefile b/Rakefile
index 5ee59ba..c213697 100644
--- a/Rakefile
+++ b/Rakefile
@@ -28,6 +28,7 @@ begin
s.homepage = "http://github.com/langalex/couch_potato"
s.description = "Ruby persistence layer for CouchDB"
s.authors = ["Alexander Lang"]
+ s.files = FileList["[A-Z]*.*", "{lib,spec,rails}/**/*", "init.rb"]
end
$ time dd if=/dev/urandom of=testfile bs=1024 count=$((1024 * 1024))
1048576+0 records in
1048576+0 records out
1073741824 bytes transferred in 158.475750 secs (6775433 bytes/sec)
real 2m38.479s
user 0m1.718s
sys 2m29.530s
$ time dd if=/dev/zero of=testfile bs=1024 count=1 seek=$((1024 * 1024))
1+0 records in
@febeling
febeling / Rakefile.rb
Created April 29, 2009 22:23
Create ruby stdlib documentation
require 'rbconfig'
LIBDIR = Config::CONFIG['rubylibdir']
DOCDIR = File.expand_path(Config::CONFIG['ruby_install_name'] + "_rdoc")
BINDIR = Config::CONFIG['bindir']
RUBY = BINDIR + '/'+ Config::CONFIG['ruby_install_name']
TITLE = "Ruby #{RUBY_VERSION} Stdlib Documentation"
/ruby(.*)/.match(Config::CONFIG['ruby_install_name'])
SUFFIX = $1
@febeling
febeling / gist:775864
Created January 12, 2011 08:15
Rake Quick Reference, by Greg Houston
# Rake Quick Reference
# by Greg Houston
# http://ghouston.blogspot.com/2008/07/rake-quick-reference.html
# -----------------------------------------------------------------------------
# Running Rake
# -----------------------------------------------------------------------------
# running rake from the command-line:
# rake --help
@febeling
febeling / .gitignore
Created February 13, 2012 11:07
Try multifile
/ExampleTypingAttributes.xcodeproj/project.xcworkspace/contents.xcworkspacedata
/ExampleTypingAttributes.xcodeproj/project.xcworkspace/xcuserdata/*.xcuserdatad/UserInterfaceState.xcuserstate
/ExampleTypingAttributes.xcodeproj/project.xcworkspace/xcuserdata/*.xcuserdatad/WorkspaceSettings.xcsettings
/ExampleTypingAttributes.xcodeproj/xcuserdata/*.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
/ExampleTypingAttributes.xcodeproj/xcuserdata/*.xcuserdatad/xcschemes/ExampleTypingAttributes.xcscheme
/ExampleTypingAttributes.xcodeproj/xcuserdata/*.xcuserdatad/xcschemes/xcschememanagement.plist
~*
@febeling
febeling / .gitignore
Created February 29, 2012 22:16
StatusItemPopover
xcuserdata
@febeling
febeling / Instrospection.m
Created February 29, 2012 23:00
objective-c instrospection
#import <objc/runtime.h>
-(void)dumpInfo
{
Class clazz = [self class];
u_int count;
Ivar* ivars = class_copyIvarList(clazz, &count);
NSMutableArray* ivarArray = [NSMutableArray arrayWithCapacity:count];
for (int i = 0; i < count ; i++)