Skip to content

Instantly share code, notes, and snippets.

@onli
onli / until-bug.rb
Created December 6, 2012 21:37
stops after until-loop if i reaches @cpus.size. why?
def getBetter()
puts "getBetter"
puts "@cpus.length: #{@cpus.length}"
puts "current cpu: #{self.cpu.type}"
begin
i = @cpus.index(self.cpu) + 0 # this only works if cpu is taken from this instance of @cpus
rescue Exception => e
@cpus.each do |cpu|
if cpu.type == self.cpu.type
@onli
onli / layered.inc.php
Last active December 20, 2015 13:08
Zenddb as abstraction layer
<?php
use Zend\Db\Sql\Sql;
use Zend\Db\Sql\Select;
use Zend\Db\Adapter\Adapter;
$result = null;
/**
* Tells the DB Layer to start a DB transaction.
*
* @access public
@onli
onli / rsa.sh
Created January 8, 2014 17:04
rsa in bash (with bc), a few years old
#!/bin/bash
getPrim() {
local range="$1"
local prim=$(getRandom $range)
until [[ $prim -gt 1 ]] && isPrim $prim;do
prim=$(getRandom $range)
done
echo $prim
return 0
@onli
onli / keybase.md
Created June 19, 2014 08:54
keybase proof

Keybase proof

I hereby claim:

  • I am onli on github.
  • I am onli (https://keybase.io/onli) on keybase.
  • I have a public key whose fingerprint is 7CA0 26FD 9C88 506C 85A0 91AE F321 B890 CF11 F733

To claim this, I am signing this object:

@onli
onli / stacktrace-finalterm-ctrl+d.txt
Last active August 29, 2015 14:03
freeze finalterm
#0 0xb7fdd424 in __kernel_vsyscall ()
#1 0xb7012d4b in pthread_cond_wait@@GLIBC_2.3.2 ()
at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/pthread_cond_wait.S:187
#2 0xb72648ec in __pthread_cond_wait (cond=0x80db7d0, mutex=0x80da6fc)
at forward.c:149
#3 0xb6a70607 in ?? () from /usr/lib/i386-linux-gnu/libxcb.so.1
#4 0xb6a70a88 in ?? () from /usr/lib/i386-linux-gnu/libxcb.so.1
#5 0xb6a70b2a in xcb_writev () from /usr/lib/i386-linux-gnu/libxcb.so.1
#6 0xb6f0a130 in _XSend () from /usr/lib/i386-linux-gnu/libX11.so.6
#7 0xb6f0a70a in _XReply () from /usr/lib/i386-linux-gnu/libX11.so.6
@onli
onli / gist:47dbca50bb83d4e2a31b
Created July 17, 2014 21:53
ctrl+d freeze 2, finalterm
#0 0xb7fdd424 in __kernel_vsyscall ()
#1 0xb6ffb9e2 in __lll_lock_wait ()
at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/lowlevellock.S:144
#2 0xb6ff7283 in _L_lock_1144 () from /lib/i386-linux-gnu/libpthread.so.0
#3 0xb6ff7213 in __GI___pthread_mutex_lock (mutex=0x80da348)
at ../nptl/pthread_mutex_lock.c:134
#4 0xb724aaf4 in pthread_mutex_lock (mutex=0x80da348) at forward.c:192
#5 0xb7390100 in g_mutex_lock () from /lib/i386-linux-gnu/libglib-2.0.so.0
#6 0xb7348ddc in g_source_attach () from /lib/i386-linux-gnu/libglib-2.0.so.0
#7 0xb734c245 in g_idle_add_full () from /lib/i386-linux-gnu/libglib-2.0.so.0
@onli
onli / solarized-dark.conf
Created September 28, 2014 18:20
Solarized Dark for Geany with highlighted comments and stronger bracket highlight
#
# Copyright 2011 Ethan Schoonover <es(at)ethanschoonover(dot)com>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
{
"status":{
"code":200,
"http":"Fetched (ring) 200 3600 and parsed 2/20 entries",
"nextFetch":1413381366,
"entriesCountSinceLastMaintenance":16,
"period":3600,
"lastFetch":1413377766,
"lastParse":1413377766,
"lastMaintenanceAt":1413311756,
{
"status":{
"code":200,
"http":"Fetched (ring) 200 3600 and parsed 2/20 entries",
"nextFetch":1413378779,
"entriesCountSinceLastMaintenance":14,
"period":3600,
"lastFetch":1413375179,
"lastParse":1413375179,
"lastMaintenanceAt":1413311756,
{
"status":{
"code":200,
"http":"Fetched (ring) 200 3600 and parsed 2/20 entries",
"nextFetch":1413376196,
"entriesCountSinceLastMaintenance":12,
"period":3600,
"lastFetch":1413372596,
"lastParse":1413372596,
"lastMaintenanceAt":1413311756,