Skip to content

Instantly share code, notes, and snippets.

shilov / main.go
Created March 27, 2015 18:20
xdg-open chrome
package main
import (
func main() {
try := []string{"xdg-open", "google-chrome", "open"}
for _, bin := range try {
err := exec.Command(bin, "").Run()
# Author: (Benjamin Staffin)
# Set your terminal's color palette to match the Solarized color scheme by
# using escape sequences. Uses OSC 4 to set colors.
# This will work with many terminal emulators, but not all.
set -o nounset
shilov / gist:28ebee32bf0fb21a0160
Created February 17, 2015 08:03
Drop all databases in Postgres by removing the current data cluster and recreating it
sudo pg_dropcluster --stop 9.4 main && sudo pg_createcluster 9.4 main && sudo pg_ctlcluster 9.4 main start
"Hi, I’d like to hear a TCP joke."
"Hello, would you like to hear a TCP joke?"
"Yes, I’d like to hear a TCP joke."
"OK, I’ll tell you a TCP joke."
"Ok, I will hear a TCP joke."
"Are you ready to hear a TCP joke?"
"Yes, I am ready to hear a TCP joke."
"Ok, I am about to send the TCP joke. It will last 10 seconds, it has two characters, it does not have a setting, it ends with a punchline."
"Ok, I am ready to get your TCP joke that will last 10 seconds, has two characters, does not have an explicit setting, and ends with a punchline."
"I’m sorry, your connection has timed out. Hello, would you like to hear a TCP joke?"
shilov / honeybadger.cap
Created December 27, 2013 00:07 deploy task for Capistrano 3
namespace :deploy do
desc "Notifies Honeybadger locally using curl"
task :notify_honeybadger do
on roles(:app) do
require 'json'
require 'honeybadger'
require './config/initializers/honeybadger'
rescue LoadError
shilov /
Created August 25, 2012 22:10
nginx upstart
# nginx
description "nginx http daemon"
start on (filesystem and net-device-up IFACE=lo)
stop on runlevel [!2345]
env DAEMON=/usr/bin/nginx
env PID=/usr/local/nginx/logs/
shilov / app.rb
Created March 26, 2012 03:24 — forked from cpatni/app.rb
unique calculation using redis
require 'sinatra'
require 'redis'
require 'json'
require 'date'
class String
def &(str)
result = ''
shilov / redis_json_marshal_eval_benchmarks.rb
Created January 27, 2012 23:01
Ruby Redis benchmarks for JSON vs Marshal vs String
require 'benchmark'
require 'json'
require 'redis'
# -----------------
puts "Initialize variables.."
shilov /
Created November 25, 2011 22:32
Removing libmysqlclient16 cauces dependency issues, but keeping it causes problems for Ruby's mysql2 gem
[user@debian:~] 02:29:30 PM: aptitude purge libmysqlclient16
The following packages will be REMOVED:
0 packages upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 4481 kB will be freed.
The following packages have unmet dependencies:
libdbd-mysql-perl: Depends: libmysqlclient16 (>= 5.1.21-1) but it is not going to be installed.
The following actions will resolve these dependencies:
Remove the following packages: