Skip to content

Instantly share code, notes, and snippets.

@koutoftimer
koutoftimer / tmux.conf
Created March 7, 2018 13:47
tmux configuration file
# Start windows and panes at 1, not 0
set -g base-index 1
setw -g pane-base-index 1
# Change <command> key
unbind C-b
set -g prefix `
# Send "`" to the terminal by double pressing command key <`>
set-option -g prefix `
@koutoftimer
koutoftimer / dec.py
Created February 21, 2018 15:06
Decrypt GPG encrypted mail
#!/usr/bin/env python3
import sys
import quopri
import subprocess as sp
def main():
#: Retrieve mail from the clipboard.
#: Depends on your system configuration.
encrypted = sp.Popen(['xclip', '-o'], stdout=sp.PIPE)
@koutoftimer
koutoftimer / run.py
Last active November 6, 2016 22:38
Resolve tail recursion depth limitation in python
"""
Thanks to Kyle Miller for his article "Tail call recursion in Python" [1].
Despite how good is to remove this limitation, probably, you have to be
aware of why this feature is not officially supported. [2]
[1]: http://www.kylem.net/programming/tailcall.html
[2]: http://neopythonic.blogspot.com/2009/04/tail-recursion-elimination.html
"""
@koutoftimer
koutoftimer / midnight_db_dump.sh
Last active October 7, 2016 11:31
Template for contab job about dumping mysql database for django applications
#!/usr/bin/env bash
# -*- encoding: utf-8 -*-
# Script makes a backup of mysql database by retieving settings from .env file.
#
# 'stdout' stream can be logged but script itself has no logging logic.
#
# If everything goes right, exit code will be equal to zero so you can use this
# for builing wrappers around it to infrom that backup failed execution.
@koutoftimer
koutoftimer / habraproxy.py
Last active October 25, 2015 12:23
habraproxy
# ~*~ encoding: utf-8 ~*~
import argparse
import re
import requests
from urllib import urlencode
from urlparse import urljoin, urlparse
from bs4 import BeautifulSoup
from flask import Flask, Response, stream_with_context, request
/**
* Create a new socket instance between client and server,
* and start use it
*
* @method mySocketChatRoom
*
* @param roomId {String} A unique string to represent a single room
* @param username {String} The username to use on this room
*/
function mySocketChatRoom(roomId, username) {
@koutoftimer
koutoftimer / preconfig.sh
Last active August 29, 2015 14:13
Script to preconfigure new system with custom settings
#!/usr/bin/env bash
# ~*~ coding: utf-8 ~*~
##########################################
# Installing commons
##########################################
command_exist () { which $1 > /dev/null; }
# Install vim
@koutoftimer
koutoftimer / .vimrc
Last active August 29, 2015 14:13
Base vim configuration
""""""""""""""""""""""""""""
" Vandle
""""""""""""""""""""""""""""
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
@koutoftimer
koutoftimer / .tmux.conf
Last active August 29, 2015 14:11
tmux config
# replace C-B (command) with symbol `
set -g prefix `
bind ` send-prefix
# command+a paste symbol `
bind-key a send-keys `
# command+r reread conf file
bind-key r source-file ~/.tmux.conf
@koutoftimer
koutoftimer / run.sh
Last active August 29, 2015 14:10
shh socks5 proxy with Firefox
#!/usr/bin/env bash
echo Now run firefox -> preferences -> advanced -> network -> settings -> Manual proxy configuration \
SOCKS Host: 127.0.0.1 Port:8080
# Change user@superhost.com with any ssh alias or so
ssh -D 8080 -C -N user@superhost.com