This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signal.trap 'SIGUSR2' do | |
# Using a thread because we cannot acquire mutexes in a trap context in | |
# ruby 2.0 | |
Thread.new do | |
Thread.list.each do |thread| | |
next if Thread.current == thread | |
puts '----[ Threads ]----' + '-' * (100-19) | |
if thread.backtrace | |
puts "Thread #{thread} #{thread['label']}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Cookbook Name:: redis | |
# Recipe:: _server_install_from_source | |
include_recipe "build-essential" | |
redis_source_tarball = "redis-#{node.redis.source.version}.tar.gz" | |
redis_source_url = "#{node.redis.source.url}/#{redis_source_tarball}" | |
user node.redis.user |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rethinkdb' | |
include RethinkDB::Shortcuts | |
10.times.map do |i| | |
Thread.new do | |
begin | |
db = i.to_s | |
c = r.connect(:host => 'localhost', :port => 28015, :db => db).repl | |
100.times do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rethinkdb' | |
include RethinkDB::Shortcuts | |
c = r.connect(:host => 'localhost', :port => 28015, :db => 'db').repl | |
100.times do | |
r.db_drop('db').run(c) rescue nil | |
r.db_create('db').run(c) | |
r.table_create('table').run(c) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pafy@bisou ~ % schedtool -h | |
get/set scheduling policies - v1.3.0, GPL'd, NO WARRANTY | |
USAGE: schedtool PIDS - query PIDS | |
schedtool [OPTIONS] PIDS - set PIDS | |
schedtool [OPTIONS] -e COMMAND - exec COMMAND | |
set scheduling policies: | |
-N for SCHED_NORMAL | |
-F -p PRIO for SCHED_FIFO only as root | |
-R -p PRIO for SCHED_RR only as root |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user nginx nginx; | |
worker_processes 1; | |
error_log /var/log/nginx/error_log info; | |
events { | |
worker_connections 1024; | |
use epoll; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'openssl' | |
require 'tempfile' | |
# How to use: | |
# cd assets/data | |
# find . -type f -print0 | xargs -L1 -0 ./decrypt.rb | |
input_path = ARGV[0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Gemfile | |
# source 'https://rubygems.org/' | |
# gem 'stretcher', git: 'git://github.com/PoseBiz/stretcher.git' | |
# gem "ruby-progressbar", :require => false | |
# gem 'multi_json' | |
# gem 'oj' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CMD="qemu" | |
INPUT="" | |
while (($#)); do | |
case $1 in | |
--input|-i) INPUT=$2; shift;; | |
*) echo "Halp";; | |
esac |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
pid = fork do | |
Process.setsid # get immune to our parent's TTY signals | |
Signal.trap("CLD") { exit } # mplayer died | |
IO.popen(['mplayer', *ARGV], :err => [:child, :out]) do |io| | |
begin | |
loop do | |
begin | |
IO.copy_stream(io, STDOUT) |