Skip to content

Instantly share code, notes, and snippets.

Sven Pachnit 2called-chaos

Block or report user

Report or block 2called-chaos

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
2called-chaos /
Last active Jul 9, 2019
Install nginx from PPA sources
# add source
cat >> /etc/apt/sources.list <<EOF
# Nginx
deb disco nginx
deb-src disco nginx
# add signing key
curl | sudo apt-key add -
2called-chaos / list.txt
Created Apr 9, 2015
GTA V files md5 hashes (Gamesplanet)
View list.txt
ff18f75f8b0ad1c1363d5cce9db813da GrandTheftAutoV.exe
882b69cc9478004e2878655a099d31ff GrandTheftAutoV.exe.001
164b9522cbf574a04603e956cf558aa4 GrandTheftAutoV.exe.002
08c2ff42b2123ed6abd91395e8869e72 GrandTheftAutoV.exe.003
1f3d7ca33f1f98897606857a2e73a33b GrandTheftAutoV.exe.004
0a7e62e837ee3784257b0dacc502d9a2 GrandTheftAutoV.exe.005
c1f95852ca39c2b3c772fd5a10007e70 GrandTheftAutoV.exe.006
2d08e283e9e47c6be5190d8ebaf811f6 GrandTheftAutoV.exe.007
ad2cfc3b2fb36bebd5cbe43681db6316 GrandTheftAutoV.exe.008
ae9f9c1b475f0eb06ff9c6c751ed809c GrandTheftAutoV.exe.009
2called-chaos / codename.rb
Last active Feb 22, 2019
Usernamegen ActiveRecord example model and rake task
View codename.rb
# create_table "codenames", force: true do |t|
# t.integer "user_id"
# t.string "name"
# t.datetime "created_at"
# t.datetime "updated_at"
# end
# add_index "codenames", ["name"], name: "index_codenames_on_name", unique: true, using: :btree
# add_index "codenames", ["user_id"], name: "index_codenames_on_user_id", unique: true, using: :btree
class Codename < ActiveRecord::Base
2called-chaos /
Last active Aug 29, 2015
Piwik in Ruby on Rails with Turbolinks (and proxy)
# Heavily inspired by
# Call `PiwikAnalytics.init()` once per document load, e.g.:
# unless $(document).data("piwik_loaded")
# PiwikAnalytics.init()
# $(document).data("piwik_loaded", "loaded")
class @PiwikAnalytics
@trackerUrl: -> "//"
@siteId: ->
2called-chaos / memprof.rb
Created Oct 14, 2014
Simple class to find memory eaters in Ruby / Rails applications
View memprof.rb
# put this in an initializer
# and use/output MemProfiler.profile all over the place (we use HTML comments).
class MemProfiler
def self.profile
Thread.main[:memprof_last_tick] ||= 0
Thread.main[:memprof_last_tick] += 1
was = Thread.main[:memprof_last_val]
now = Thread.main[:memprof_last_val] = measure
if was
2called-chaos / automatic_server_restart.rb
Created Oct 13, 2014
Automatic Server Restart (MCL handler)
View automatic_server_restart.rb
module Mcl
class AutomaticServerRestart < Handler
def setup
@stop_at = 1.hour.from_now
def tick!
# only check every 240 MCL ticks == 60 seconds
View gist:50f488044bba19c32903
in your ~/.profile
alias restartmc='ssh "cd _terra && chruby-exec 1.9 -- mcir restart"'
2called-chaos /
Created Oct 4, 2014
Bash function if you trust your skills
function with_faith { $@ &> /dev/null; }
2called-chaos /
Last active Aug 29, 2015
Essential IRC rules (to be continued)

IRC – that's how it works!

These "rules" are especially true for big channels with dozens and hundreds of users.

1. Don't ask to ask

Most channels insist on this rule. Don't ask if someone may help or is "there". Just ask your question (a greeting isn't wrong though) and be patient.

2. Highlighting

A very important one! If you ask a question you might get responses which are prefixed with your name:

2called-chaos / string_expand_ranges.rb
Last active Aug 29, 2015
Expand range like strings into lists/arrays with ruby, example at the bottom
View string_expand_ranges.rb
# Copyright (c) 2013, Sven Pachnit
# Published under the MIT license
# I wrote this in 15 minutes, I have no idea about performance.
# CPAN's String::Range::Expand is the only thing I was able to
# find and Perl is not good for my Ruby eyes ;)
# result of me being lazy :)
You can’t perform that action at this time.