Skip to content

Instantly share code, notes, and snippets.

View christianparpart's full-sized avatar
🎃
Loading

Christian Parpart christianparpart

🎃
Loading
View GitHub Profile
#! /home/trapni/local/src/redmine/script/runner -edevelopment
require 'rubygems';
require 'faster_csv';
require 'iconv';
require 'logger';
project = Project.find('stg')
tracker = Tracker.find_by_name('Feature')
author = User.find_by_login('trapni')
llvm::Value *Runner::emitToLower(llvm::Value *value)
{
#if 1 == 0 // {{{ C equivalent
return value >= 'A' && value <= 'Z'
? value + 32
: value;
#endif // }}}
// IR:
// %off = add %ch, -65
define i8* @_strcasestr(i8* %haystack, i8* nocapture %needle) nounwind readonly {
; <label>:0
%1 = tail call i64 @strlen(i8* %haystack) ; <i64> [#uses=1]
%2 = trunc i64 %1 to i32 ; <i32> [#uses=1]
%3 = tail call i64 @strlen(i8* %needle) ; <i64> [#uses=1]
%4 = trunc i64 %3 to i32 ; <i32> [#uses=2]
%5 = icmp slt i32 %2, %4 ; <i1> [#uses=1]
br i1 %5, label %.loopexit, label %.preheader
.preheader: ; preds = %0
@christianparpart
christianparpart / gist:653118
Created October 29, 2010 08:01
mySQL idle timeout to rip off my redmine runner script.
Mysql::Error: MySQL server has gone away: SELECT * FROM `projects` WHERE (`projects`.`identifier` = 'stg') LIMIT 1
/waflhome/redmine/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_qu /waflhome/redmine/redmine/script/runner:3/1.8/rubygems/custom_require.rb:31:in `require'inal_require'ind_by_identifier'ache.rb:62:in `select_all'
disconnected from server
/waflhome/redmine/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract_adapter.rb:219:in `log': Mysql::Error: MySQL server has gone away: SELECT * FROM `projects` WHERE (`projects`.`identifier` = 'stg') LIMIT 1 (ActiveRecord::StatementInvalid)
from /waflhome/redmine/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:323:in `execute'
from /waflhome/redmine/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_a
[ 8.494471] systemd[1]: systemd 13 running in system mode. (+PAM +LIBWRAP -AUDIT -SELINUX +SYSVINIT -LIBCRYPTSETUP; gentoo)
Welcome to Gentoo Base System release 2.0.1-r1!
[ 8.564844] systemd[1]: Set hostname to <sensei>.
Starting Apply Kernel Variables...
[ 8.854172] systemd[1]: Failed to initialize automounter: No such file or directory
[ 8.869595] systemd
[ 8.871760] systemd-sysctl used greatest stack depth: 3880 bytes left
[ 8.886681] [1]: Unit sys-kernel-security.automount entered failed state.
Starting Lock Directory...
Starting Runtime Directory...
# x0: accepting client
accept4(6, 0, NULL, SOCK_CLOEXEC|SOCK_NONBLOCK) = 5
# libev: writing to eventfd, getting clock, waiting, getting clock, reading from eventfd
write(4, "\1\0\0\0\0\0\0\0", 8) = 8
clock_gettime(CLOCK_MONOTONIC, {7346, 989127305}) = 0
epoll_wait(3, {{EPOLLIN, {u32=4, u64=4294967300}}}, 64, 59743) = 1
clock_gettime(CLOCK_MONOTONIC, {7346, 989185717}) = 0
read(4, "\1\0\0\0\0\0\0\0", 8) = 8
@christianparpart
christianparpart / gist:961006
Created May 8, 2011 01:05
rubnius error output vs rails 3 app
trapni@shougar ~/projects/ialu $ rails s
WARNING: This version of mysql2 (0.3.2) doesn't ship with the ActiveRecord adapter bundled anymore as it's now part of Rails 3.1
WARNING: Please use the 0.2.x releases if you plan on using it in Rails <= 3.0.x
An exception occurred running script/rails
method 'const_defined?': given 2, expected 1 (ArgumentError)
Backtrace:
{ } in ActiveSupport::Inflector(Module)#constantize at /home/trapni/.rvm/gems
/rbx-head/gems
/activesupport-3.0.7/lib
@christianparpart
christianparpart / flow.vim
Created May 22, 2011 16:38
VIM syntax file excerpt
" IPv6 address
syn match flowIPv6 /[a-fA-F0-9:]*::[a-fA-F0-9:.]*/
syn match flowIPv6 /[a-fA-F0-9:]\+:[a-fA-F0-9:]\+:[a-fA-F0-9:.]\+/
" identifiers
syn match flowIdent /[a-zA-Z][a-zA-Z0-9_.]*\(:\)\@!/
@christianparpart
christianparpart / gist:1111922
Created July 28, 2011 16:49
strace php-cgi wrt. "no input file specified"
accept(5, {sa_family=AF_INET, sin_port=htons(48486), sin_addr=inet_addr("127.0.0.1")}, [16]) = 6
poll([{fd=6, events=POLLIN}], 1, 5000) = 1 ([{fd=6, revents=POLLIN}])
read(6, "\1\1\0\1\0\10\0\0", 8) = 8
read(6, "\0\1\0\0\0\0\0\0", 8) = 8
read(6, "\1\4\0\1\2\21\7\0", 8) = 8
read(6, "\f\0QUERY_STRING\16\3REQUEST_METHODGE"..., 536) = 536
read(6, "\1\4\0\1\0\0\0\0", 8) = 8
brk(0xf9a000) = 0xf9a000
setitimer(ITIMER_PROF, {it_interval={0, 0}, it_value={60, 0}}, NULL) = 0
rt_sigaction(SIGPROF, {0x662580, [PROF], SA_RESTORER|SA_RESTART, 0x7fab20b7d810}, {0x662580, [PROF], SA_RESTORER|SA_RESTART, 0x7fab20b7d810}, 8) = 0
@christianparpart
christianparpart / gist:1271219
Created October 7, 2011 19:55
i2cdetect optimus
windsor linux-3.0 # i2cdetect 1
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-1.
I will probe address range 0x03-0x77.
Continue? [Y/n] y
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --