Skip to content

Instantly share code, notes, and snippets.

View rkh's full-sized avatar
👀
heeeyyyy

Konstantin Haase rkh

👀
heeeyyyy
View GitHub Profile
#!/usr/bin/env ruby
require "mechanize"
require "highline/import"
require "fileutils"
HighLine.track_eof = false
a = WWW::Mechanize.new { |agent| agent.user_agent_alias = 'Mac Safari' }
repos = {}
#!/bin/bash
#
# Usage: install_ruby VERSION
#
# VERSION should be something like 1.8.7 or 1.9.2dev
# it will also install rubygems and rake
#
# To update, simply run again.
if [ -z $PREFIX ]; then
...
gcc -g -O2 -fno-common -pipe -fno-common -DRUBY_EXPORT -I. -I. -c main.c
gcc -g -O2 -fno-common -pipe -fno-common -DRUBY_EXPORT -I. -I. -c dmydln.c
gcc -g -O2 -fno-common -pipe -fno-common -DRUBY_EXPORT -L. main.o dmydln.o libruby-static.a -lpthread -ldl -lobjc -o miniruby
ruby: [BUG] Segmentation fault
ruby 1.8.6 (2009-06-08) [i686-darwin9.6.0]
make: *** [.rbconfig.time] Abort trap
~ → RUBY_VERSION=1.8.7 ruby -e "require 'sequel'; puts (:foo > Time.now).inspect"
#<Sequel::SQL::BooleanExpression:0x11bafac @args=[:foo, Fri Jun 26 15:38:06 +0200 2009], @op=:>>
~ → RUBY_VERSION=1.9.1 ruby -e "require 'sequel'; puts (:foo > Time.now).inspect"
-e:1:in `>': comparison of Symbol with Time failed (ArgumentError)
from -e:1:in `<main>'
# avoiding submodule, so it works with heroku
mkdir -p vendor/haml
git remote add -f haml git://github.com/nex3/haml.git
git merge -s ours --no-commit haml/master
git read-tree --prefix=vendor/haml/ -u haml/master
git commit -m "merged haml as subfolder"
@foo = 10
block = lambda { puts @foo }
module Example
@foo = 42
block.call
instance_eval(&block)
end
# Result:
#!/usr/bin/env ruby
require "fileutils"
include FileUtils::Verbose
HOST = ENV["HOST"] || "localhost"
URL = ENV["URL"] || "#{HOST}/rss"
@current_name = nil
@feeds = []
def get(name, url)
/*
* Wichtiger Hinweis:
* run/0 gibt des Rätsels Lösung formatiert aus. Es gibt in Prolog keine
* Standardisierung für formatierte Ausgabe. Zur formatierten Ausgabe wird
* format benutzt (Quintus Prolog) verwendet. Dies wird zum Beispiel von
* SWI-Prolog unterstützt. Sollte dies dem verwendeten Prolog fremd sein, so
* lässt sich das Programm dennoch verwenden, da die Logik zum Lösen des
* Sachverhalts sich gänzlich in loesung/0 befindet.
*/
registerFunction("strSplit", "com.acme.extensions.expr.SplitIterExpr");
$markovEntry = fn($words, $pos) (
$words -> slice($pos - 3, $pos) -> transform serialize($) -> strJoin(", ")
);
$markovLine = fn($line) (
$words = $line -> strSplit(" "),
range(3, count($words) - 1) -> transform $markovEntry($words, $)
);
for p in ncurses openssl zlib libvorbis expat; do sudo port install $p; done
svn checkout --revision 291 https://despotify.svn.sourceforge.net/svnroot/despotify
cd despotify/src
mv lib/session.c lib/session.c.bak
sed s/44764/99999/ lib/session.c.bak > lib/session.c
echo "CFLAGS += -I/opt/local/include" >> Makefile.local.mk
echo "LDFLAGS += -L/opt/local/lib" >> Makefile.local.mk
make && sudo make install