Skip to content

Instantly share code, notes, and snippets.

View avgerin0s's full-sized avatar

Aggelos Avgerinos avgerin0s

  • Skroutz S.A.
  • Athens, Greece
View GitHub Profile
#include <ctype.h>
#include <signal.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <syslog.h>
#include <sys/time.h>
#include <errno.h>
#include <getopt.h>
#include <librdkafka/rdkafka.h>
wulf ~ » sudo find /usr -name mysql 130 ↵
/usr/local/var/mysql
/usr/local/var/mysql/mysql
@avgerin0s
avgerin0s / git-find-br
Created May 6, 2015 07:46
Search remote branches and checkout to them using `pick`
#!/bin/sh
branch=$1
if [ -z $2 ]; then
remote=origin
else
remote=$2
fi
@avgerin0s
avgerin0s / output
Created April 13, 2015 09:37
Splat operator benchmarking
user system total real
Using the splat operator 8.050000 0.160000 8.210000 ( 8.235298)
Using sequence of params 5.300000 0.170000 5.470000 ( 5.466839)
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin14.0]
self.send(:send, :eval, "`ls`").send(:split, "\n").map(&:downcase).each { |s| s.class.send(:define_method, s.to_sym, ->{puts "a"}) }
@avgerin0s
avgerin0s / battery.sh
Created October 14, 2014 19:32
Battery notifier for linux
#!/usr/bin/zsh
percentage=`upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep "percentage" | awk '{ print $2 }' | cut -c 1-2`
if [ $percentage -lt 10 ]; then
notify-send Battery "$percentage%"
fi
@avgerin0s
avgerin0s / 0-readme.md
Last active August 29, 2015 14:07 — forked from burke/0-readme.md

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'rack', github: 'rack/rack'
gem 'i18n', github: 'svenfuchs/i18n'
gem 'sqlite3'
GEMFILE
(defn compact
"Returns a seq on the collection with any nil element removed"
[coll]
(filter (complement nil?) (seq coll)))
; Example usage
(compact [1 nil 2])
=> (1 2)