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
2called-chaos / just the upload.rb
Created Apr 20, 2012
Bad example of how to use the gem YoutubeIt
View just the upload.rb
def upload video
@app.stats.yt_videos_new +1
ldata = assemble_local_data
result = @instance.connection.video_upload(
File.open(video),
:title => ldata[:title],
:description => ldata[:desc],
:keywords => ldata[:keywords],
:category => @instance.config['target_category']
@2called-chaos
2called-chaos / each_with_position.rb
Created Oct 2, 2012
Ruby Enumerable each_with_position (provides #first? #last? #prev #next ...)
View each_with_position.rb
##################################
### SCROLL DOWN FOR AN EXAMPLE ###
##################################
module Enumerable
# your each_with_position method
def each_pos &block
EachWithPosition.each(self, &block)
end
end
@2called-chaos
2called-chaos / setup-autossh-tunnel.sh
Last active Apr 30, 2018
Adds a start script which will setup a port forwarding over SSH (via autossh) for database traffic tunneling. You can use this script for every port actually. I might called it different but I only need it for MySQL ;-)
View setup-autossh-tunnel.sh
#!/bin/bash
# Install:
# curl -O https://gist.githubusercontent.com/2called-chaos/4285767/raw/setup-autossh-tunnel.sh
# chmod u+x setup-autossh-tunnel.sh
# ./setup-autossh-tunnel.sh
SSH_USER="mysql_tunnel"
SSH_SERVER="db.example.net"
SSH_PORT="22"
View gist:4503914
Sehr geehrte Damen und Herren,
wie Sie sicherlich in den Medien verfolgt haben, sinkt die Anzahl von freien IPv4-Adressen
weltweit drastisch. In Europa ist der verfügbare Adresspool bereits vollständig vergeben.
Auch wir erhalten vom europäischen IP-Adressverwalter Reseaux IP Europeens (RIPE) keine
weiteren IPv4-Adressen.
Da die Nachfrage nach IPv4-Adressen jedoch weiterhin sehr hoch ist, sind wir gezwungen,
die Verwendung sowie die Vergabe an Kunden restriktiver zu gestalten.
@2called-chaos
2called-chaos / Start rails application on startup
Created Jan 14, 2013
Start rails application on startup. Insert this into /etc/rc.local before the line "exit 0" (do not remove the shebang/1st line either). Change basepath and webuser respectively.
View Start rails application on startup
# Insert this into /etc/rc.local before the line "exit 0" (do not remove the shebang/1st line either)
# Change basepath and webuser respectively.
rails_start() { screen -md su - www-data -c "cd /home/www/$1/current ; bundle exec unicorn -c config/unicorn.rb -E production -D"; }
rails_start "com.example"
rails_start "some_app"
@2called-chaos
2called-chaos / install_nginx_vim.sh
Created Mar 3, 2013
enable nginx vim syntax highlighting (on Ubuntu/Debian)
View install_nginx_vim.sh
#!/bin/sh
mkdir -p ~/.vim/syntax/
cd ~/.vim/syntax/
wget http://www.vim.org/scripts/download_script.php?src_id=19394
mv download_script.php\?src_id\=19394 nginx.vim
cat > ~/.vim/filetype.vim <<EOF
au BufRead,BufNewFile /etc/nginx/*,/usr/local/nginx/conf/* if &ft == '' | setfiletype nginx | endif
EOF
View add_as_a_bookmark.js
// Put this into a bookmark or paste it
// (beware that at least Chrome strips
// away the `javascript:` for security reasons)
javascript:var customStyles = document.createElement('style'); customStyles.appendChild(document.createTextNode('body * { -webkit-transition: all 0.25s ease-in-out;-moz-transition: all 0.25s ease-in-out;-o-transition: all 0.25s ease-in-out;transition: all 0.25s ease-in-out;}body *:hover {-webkit-transform: rotate(180deg);-moz-transform: rotate(180deg);-ms-transform: rotate(180deg);-o-transform: rotate(180deg);transform: rotate(180deg);}'));document.documentElement.insertBefore(customStyles);
View request.xml
<?xml version="1.0" encoding="UTF-8"?>
<notice version="2.0">
<api-key>4c34e088c66a4460b88a8a2159cb5003</api-key>
<notifier>
<name>airbrake_js</name>
<version>0.2.0</version>
<url>http://airbrake.io</url>
</notifier>
<error>
<class>Error</class>
View sidekiq.log
2013-07-27T05:13:40Z 1610 TID-fo9os PostReceive JID- INFO: done: 0.03 sec
2013-07-27T05:24:10Z 1610 TID-jghnk PostReceive JID- INFO: start
2013-07-27T05:24:10Z 1610 TID-jghnk PostReceive JID- INFO: done: 0.032 sec
2013-07-27T05:29:34Z 1610 TID-fo9os PostReceive JID- INFO: start
2013-07-27T05:29:34Z 1610 TID-fo9os PostReceive JID- INFO: done: 0.028 sec
2013-07-27T05:35:19Z 1610 TID-jghnk PostReceive JID- INFO: start
2013-07-27T05:35:19Z 1610 TID-jghnk PostReceive JID- INFO: done: 0.029 sec
2013-07-27T05:37:58Z 1610 TID-fo9os PostReceive JID- INFO: start
2013-07-27T05:37:58Z 1610 TID-fo9os PostReceive JID- INFO: done: 0.03 sec
2013-07-27T05:39:39Z 1610 TID-jghnk PostReceive JID- INFO: start
View page_sketch.coffee
window.PageSketch =
init: ->
@opened = false
@redo_buffer = []
# custom sketch close link
@getCloseLink().click (ev) =>
@toggleSketch()
return false
You can’t perform that action at this time.