Skip to content

Instantly share code, notes, and snippets.

BASE_PATH = "<%= _base_path %>"
working_directory "#{BASE_PATH}/current"
pid "#{BASE_PATH}/shared/pids/unicorn.pid"
stderr_path "#{BASE_PATH}/shared/log/unicorn.stderr.log"
stdout_path "#{BASE_PATH}/shared/log/unicorn.stdout.log"
listen 3000
worker_processes <%= _worker_processes %>
timeout 30
#!/usr/bin/env ruby
MAP = {"a" => "2", "b" => "22", "c" => "222", "d" => "3", "e" => "33", "f" => "333", "g" => "4", "h" => "44", "i" => "444", "j" => "5", "k" => "55", "l" => "555", "m" => "6", "n" => "66", "o" => "666", "p" => "7", "q" => "77", "r" => "777", "s" => "7777", "t" => "8", "u" => "88", "v" => "888", "w" => "9", "x" => "99", "y" => "999", "z" => "9999", " " => "0"}
lines = $<.readlines
lines.shift
while lines.any?
message = lines.shift.chomp.split(//).map {|x| MAP[x]}
# ["44", "444"]
>> class Foo
>> def self.bar
>> puts 'bar'
>> end
>> def baz
>> Foo.bar
>> puts 'baz'
>> end
>> end
=> nil
@omarqureshi
omarqureshi / import_plot.rb
Last active December 17, 2015 15:19
Dirty script to analyze the plot.list IMDB data file
#!/usr/bin/env ruby
require 'iconv'
require 'pg'
require 'data_mapper'
require 'dm-postgres-adapter'
DataMapper::Logger.new($stdout, :debug)
DataMapper.setup(:default, 'postgres://127.0.0.1/movies')
# From a fresh install of wheezy
apt-get install ruby1.8 rubygems # Need ruby to use fpm
gem1.8 install fpm --no-ri --no-rdoc
apt-get install build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev ncurses-dev libyaml-dev emacs curl autoconf
wget http://www.mirrorservice.org/sites/ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p392.tar.gz
tar -zxvf ruby-1.9.3-p392.tar.gz
cd ruby-1.9.3-p392
php > print_r(parse_url("http://somesite.blogg.se/whatever?cunt"));
Array
(
[scheme] => http
[host] => somesite.blogg.se
[path] => /whatever
[query] => cunt
)
@omarqureshi
omarqureshi / README.md
Last active December 18, 2015 13:09
Xen on Ubuntu 12.04

Setting up XEN on a Hetzner Dedicated Server (EX-series)

Author: Michael van Rooijen (@meskyanichi)

DISCLAIMER: I am a programmer, not a sysadmin in my day-to-day life. I provide this guide simply as a self-reference, and as a way to contribute to the community of developers. The main motivation for writing this guide is because of the lack of properly written guides/tutorials. They were either out-dated, inaccurate, in a non-English language or simply too vague to understand (at least for me, as a programmer and not a sysadmin).

I hope this guide helps getting you up and running with your own collection of VPS's on your own Dedicated Server over at Hetzner.de.

Requirements:

stage { 'first': before => Stage['main'] }
stage { 'last': require => Stage['main'] }
Exec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/", "/usr/local/bin" ] }
node default {
package {"ntp": ensure => installed}
service {"ntp": ensure => running, require => Package["ntp"]}
package {"libxml2": ensure => installed}
package {"libxml2-dev": ensure => installed}
class user {
define add() {
$username = $title
user {$username:
home => "/home/${username}",
shell => "/bin/bash",
groups => ["wheel"] }
file { "/home/$username/":
# Description:
# Spits out Look my strong gif
#
# Commands:
# look my strong
module.exports = (robot) ->
robot.hear /look my strong/i, (msg) ->
msg.send "http://cdn.gifbay.com/2013/09/look_my_strong-86403.gif"