Skip to content

Instantly share code, notes, and snippets.

Avatar

Gabriele Renzi riffraff

View GitHub Profile
View gist:9362785
$ otool -l ./Contents/Resources/bin/ozemulator
./Contents/Resources/bin/ozemulator:
Load command 0
cmd LC_SEGMENT_64
cmdsize 72
segname __PAGEZERO
vmaddr 0x0000000000000000
vmsize 0x0000000100000000
fileoff 0
filesize 0
View keybase.md

Keybase proof

I hereby claim:

  • I am riffraff on github.
  • I am riffraff (https://keybase.io/riffraff) on keybase.
  • I have a public key whose fingerprint is 2E84 DF2D 6038 DAA0 F7D5 1B66 32BB 1A7F 22C3 BB65

To claim this, I am signing this object:

View gist:f4e63bac0ae9ef38b26f
ssh ()
{
REMOTE_TERMINAL_THEME_NAME="Solarized Light";
SSH=$(which ssh);
CURTHEME=$(osascript -e "tell application \"Terminal\" to get the name of current settings of the selected tab of the front window");
CURTAB=$(osascript -e "tell application \"Terminal\" to get the selected tab of the front window");
osascript -e "tell application \"Terminal\" to set current settings of $CURTAB to settings set \"$REMOTE_TERMINAL_THEME_NAME\"";
$SSH "$@";
osascript -e "tell application \"Terminal\" to set current settings of $CURTAB to settings set \"$CURTHEME\""
}
View run-forever
#!/usr/bin/env ruby
# vim: syntax=ruby
require 'timeout'
timeout = (ENV['TIMEOUT'] || 2*60*60).to_i
def log str
puts "run-forever: #{str}"
end
View quiz.rb
# use a single string object as IO, enforces ordering, use srand to avoid randomness and stubbing/subclassing
class Quiz
def initialize(input = STDIN, output = STDOUT)
@input = input
@output = output
end
def problem
first = rand(10)
second = rand(10)
View gist:114222
//this should be builtin in 2.8
def groupBy[T](list: List[T], eq: (T,T) => Boolean ): List[List[T]] = list match {
case Nil => Nil
case x::xs => {
val (ys:List[T],zs:List[T]) = xs.span(eq(_,x));
(x::ys)::groupBy(zs, eq)
}
}
def compress3[T](list: List[T]): List[T] =
View gist:118069
Solr:
<fieldtype name="parsedType" indexed="true" stored="true" compressed="true" class="solr.TextField" sortMissingLast="true">
<analyzer class="org.apache.lucene.analysis.SimpleAnalyzer"/>
</fieldtype>
<field name="name"type="parsedType" required="true" multiValued="false"/>
document.addField(NAME, name);
solrServer.add(document);
View gist:311023
akosma = 0.0
mph = 0.0
manuelmeurer = 0.0
alinet010 = 0.0
dbarison = 0.0
atinypixel = 0.0
mattslack = 0.0
nullobject = 0.0
fritzZz = 0.0
jyn = 0.0
View gist:335145
ERROR - Internal error processing multiget_slice
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at org.apache.cassandra.service.CassandraServer.readColumnFamily(CassandraServer.java:79)
at org.apache.cassandra.service.CassandraServer.getSlice(CassandraServer.java:174)
at org.apache.cassandra.service.CassandraServer.multigetSliceInternal(CassandraServer.java:247)
at org.apache.cassandra.service.CassandraServer.multiget_slice(CassandraServer.java:219)
at org.apache.cassandra.service.Cassandra$Processor$multiget_slice.process(Cassandra.java:927)
at org.apache.cassandra.service.Cassandra$Processor.process(Cassandra.java:817)
View gist:350453
require 'enumerator'
require 'mu'
def f (ary, size)
needed = ary.size - size
while needed > 0
result = Array.new
ary.each_slice(2) do |a,b|
if needed > 0
result << a+b
needed-=1