Skip to content

Instantly share code, notes, and snippets.

@chesster
chesster / .zshrc
Created January 15, 2014 13:42
FTP file list to file
remote_ftp_list(){
lftp -e 'find /;bye' $1 >$1._filelist
}
@chesster
chesster / ccal.py
Created February 17, 2014 03:07
Two month conky calendar
#!/usr/bin/env python
import time, calendar, re
def display_cals():
localtime = time.localtime(time.time())
weeks = cal(localtime[0], localtime[1], localtime[2], 10)
cal(localtime[0], localtime[1]+1, 0, 190, int('-%s' % (16*weeks)))
def cal(year, month, day=0, offset=0, voffset=0):
calendar.setfirstweekday(calendar.SUNDAY)
@chesster
chesster / feed.coffee
Created February 18, 2014 00:55
RSS on a blog
feedLoaded = (result) ->
unless result.error
container = document.getElementById("rssnews")
if container
container.innerHTML = ""
i = 0
ul = document.createElement("ul")
ul.setAttribute "class", "posts"
while i < result.feed.entries.length
[color]
ui = true
[alias]
lg = !"git lg1"
st = status
lg1 = log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(bold white)— %an%C(reset)%C(bold yellow)%d%C(reset)' --abbrev-commit --date=relative
lg2 = log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(bold white)— %an%C(reset)' --abbrev-commit
ci = commit
co = checkout
df = diff
/* Set the defaults for DataTables initialisation */
jQuery.extend(true, jQuery.fn.dataTable.defaults, {
"sDom": "<'row'<'col-sm-12'<'pull-right'f><'pull-left'l>r<'clearfix'>>>t<'row'<'col-sm-12'<'pull-left'i><'pull-right'p><'clearfix'>>>",
"sPaginationType": "bs_normal",
"oLanguage": {
"sLengthMenu": "_MENU_ records per page",
"sSearch": "Search"
},
"fnPreDrawCallback": function(oSettings, json) {
$('.dataTables_filter input').addClass('form-control input-sm');
import recurly as recurly_api
from django.core.cache import cache
from django.conf import settings
from hashlib import sha512
def string_to_key(string):
return sha512(string).hexdigest()[:250] # max size of caching keys in memcached
def function_cache(timeout=300, override_key=None):
@chesster
chesster / TraktTv.py
Created April 21, 2014 22:15
Trakt.Tv via console. [pip install clint docopt] + Update APIKEY, USER, PWD
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
TraktTvPy
Usage:
TraktTv.py search <term> [--add] [options]
TraktTv.py watchlist [--delete] [--watch] [--unwatch] [options]
TraktTv.py -h | --help
[
"2014-05-13T11:07:38.383364",
{
"custom": [
{
"accounting_code": "custom",
"description": "Customer or a specially quoted offer. Pricing & payment terms always set per customer. This is for *existing* customer when starting to offer new priceplan",
"monthly_unit_amounts_in_cents": {
"EUR": 100050,
"SEK": 1000000,
[
"2014-04-06T16:46:15.119769",
{
"custom": [
{
"accounting_code": "custom",
"description": "Customer or a specially quoted offer. Pricing & payment terms always set per customer. This is for *existing* customer when starting to offer new priceplan",
"name": "Custom",
"plan__interval_unit": "months",
"plan_code": "custom",
# coding: utf-8
import os
import subprocess
import urllib
theme_names = ['3024-dark',
'3024-light',
'atelierdune-dark',
'atelierdune-light',