Skip to content

Instantly share code, notes, and snippets.

@chanux
chanux / traefik-basic.md
Last active Sep 13, 2020
Traefik quick setup
View traefik-basic.md

Traefik quick setup

This is a bare minimum guide to try traefik with Docker.

Create traefik.toml file with preferred configuration

port = ":80"

[web]
@chanux
chanux / celerybeat basic
Last active Apr 25, 2018
The absolute minimal celerybeat setup
View celerybeat basic
Following is the absolute minimal celerybeat setup. I will use redis as the broker.
Install and run redis
on Ubuntu
sudo apt-get install redis-server
on CentOS
sudo yum install redis
@chanux
chanux / example.txt
Last active Sep 24, 2017
Simple go clone of z.ero.cool 1337
View example.txt
``````
`./syhddddddhys/.`
`-sdNmy+/:....:/+ymNds-`
:dNd+- ``.....` -+dNd:
`yMd: .:++ooooooo+:. :dMy`
.dMs` .+ooo+:----:+ooo+. `sMd.
dMs .////. ./ooo: sMd
/Mm` :ooo. `mM/
oMy ooo/ yMo
oMy `ooo: yMo
@chanux
chanux / git-branches.py
Created Aug 11, 2017
Quick glance in to the state of your git branches
View git-branches.py
#!/usr/bin/env python
"""
This script implements a git subcommand for viewing git branches with
a summary on how far behind/ahead each branch is compared to current branch.
copy the file to somewhere in the path as git-branches and make it executable
then you can use `git branches` to see summary of unmerged branches
@chanux
chanux / playdog.sh
Last active Sep 28, 2016
Multimedia keybindings that works with Spotify and mocp and contect aware
View playdog.sh
#!/usr/bin/env bash
# Make your multimedia keybindings work with both spotify and mocp.
# I prefer to have them control Spotify when it's open.
# Place this script somewhere in $PATH and bind multimedia keys/your favorite
# shortcuts accordingly. The commands are self explanatory
#
# playdog -playpause
# playdog -pause
# playdog -next
@chanux
chanux / fixsrt.py
Created Mar 15, 2012
A simple python tool to fix time of srt files
View fixsrt.py
#!/usr/bin/env python
from sys import argv, exit
from os import path
import datetime
if len(argv) == 5:
(script, inputf, outputf, sign, msec) = argv
else:
print "fixsrt <input.srt> <output.srt> <+/-> <milli seconds>"
exit(1)
View keybase.md

Keybase proof

I hereby claim:

  • I am chanux on github.
  • I am chanux (https://keybase.io/chanux) on keybase.
  • I have a public key whose fingerprint is 35DA F004 6EE5 B967 5BBF 9221 4936 8DFE DF62 5DBB

To claim this, I am signing this object:

@chanux
chanux / audiolock.sh
Last active Jan 22, 2016
Pause/Play audio on screen lock/unlock
View audiolock.sh
#!/usr/bin/env bash
# This script pauses music on Ubuntu when screen is locked (cmd+l)
# My other script 'playdog' is required.
# It gives you seamless controls to vlc, spotify and mocp
# You should add this script to startup scripts
# Get playdog here: https://gist.github.com/chanux/db01bd2c66effc7a259f
dbus-monitor --session "type='signal',interface='com.ubuntu.Upstart0_6'" |
while read x; do
@chanux
chanux / mysql2postgres.py
Created Jan 19, 2016
Copy data from mysql dump file to postgres DB
View mysql2postgres.py
#!/usr/bin/env python
import argparse
import psycopg2
"""
Script to help copy data to postgres databases from mysql dump files
mysql2postgres -f <mysql dump file> -t <postgres table name> -c <comma separated list of columns>
NOTE: the column name list should be in order of dump file fields
"""
@chanux
chanux / battery.py
Last active Dec 24, 2015
Laptop battery status notifier inspired by http://www.wired.com/gadgetlab/2013/09/laptop-battery. Images are Ubuntu specific.
View battery.py
#!/usr/bin/env python
# Inspired by the article http://www.wired.com/gadgetlab/2013/09/laptop-battery
#
# Info about battery life vary depending on who you ask from. So I'm not sure
# what to believe anymore. Anyhow wrote this because the last time I tried at
# writing a battery status notifier, I failed.
#
# I couldn't live with that memory!