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 / 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
@2called-chaos
2called-chaos / gist:4eacb303b9491d1e374c
Last active Aug 19, 2019
My nginx config for dynmap (on port 8123, that's the dynmap bound to localhost so no direct call possible)
View gist:4eacb303b9491d1e374c
server {
listen 80;
server_name map.geekya.com;
# I normally wouldn't disable the access log but here I see no problem with it
access_log off;
error_log /var/log/nginx/com.geekya.map.error.log;
# custom error page when map isn't available
error_page 502 503 504 =503 /503_map.html;
@2called-chaos
2called-chaos / install_nginx_ppa.sh
Last active Jul 9, 2019
Install nginx from nginx.org PPA sources
View install_nginx_ppa.sh
# add source
cat >> /etc/apt/sources.list <<EOF
# Nginx
deb http://nginx.org/packages/ubuntu/ disco nginx
deb-src http://nginx.org/packages/ubuntu/ disco nginx
EOF
# add signing key
curl http://nginx.org/packages/keys/nginx_signing.key | sudo apt-key add -
View recaptcha3.coffee
class AppOS.Component.Recaptcha3 extends AppOS.Component
name: "recaptcha"
API_URL: "https://www.google.com/recaptcha/api.js?onload=%callback&render=explicit"
API_KEY: "MY_PUBLIC_SITEKEY"
init: ->
@pending = []
@apiState = "unloaded"
# init event
@2called-chaos
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
2called-chaos / mail.md
Created Feb 12, 2019
My letter to the MEPs concerning the copyright reform / Article 13 and 11
View mail.md

Dear Member of the European Parlament,

my name is Sven Pachnit and I work as, for and with content creators and providers of general web services. I'm deeply concerned about Article 13 and let's don't forget Article 11.

Both will harm the free internet to an enormous extend and will result in even worse conditions for small companies and startups in the EU (you already wonder why all the big web companies are in the US, it's not because they are so much better at it but the climate in the EU just isn't that appealing to have ones HQ in, this will certainly won't make it any better). I know quite a few companies that are being operated by EU citizens but they registered the company outside of the EU.

Upload filters are a huge problem. I'm guessing you are not a content creator on YouTube so let me tell you how bad the world's most advanced content filter (Content ID from Google) really is. It "detects" ones voice (with nothing else, e.g. background music) and claims it as copyright violation. It also common

@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
View recaptcha.coffee
class AppOS.Component.Recaptcha extends AppOS.Component
name: "recaptcha"
API_URL: "https://www.google.com/recaptcha/api.js?onload=%callback&render=explicit&hl=%hl"
init: ->
@pending = []
@apiState = "unloaded"
# init event
$(document).on "recaptcha:init", (ev, el) =>
@2called-chaos
2called-chaos / _form.html.erb
Last active Jan 23, 2019
Bootstrap 3 rails form builder
View _form.html.erb
<%= bs_form_for [:backend, @publisher] do |f| %>
<%= f.lock %>
<%= f.error_messages %>
<%= f.labeled_text_field :name %>
<%= f.labeled_text_field :support_link, placeholder: "http://help.ea.com", hint: "Possibly visible to customers if given." %>
<%= f.labeled_text_field :support_email, placeholder: "support@ea.com", hint: "Only for internal use." %>
<%= f.indicate_tenant(:global) unless @publisher.persisted? %>
<%= f.actions do %>
@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"
You can’t perform that action at this time.