Skip to content

Instantly share code, notes, and snippets.

@andreyfedoseev
andreyfedoseev / move-caches.py
Created November 30, 2021 16:43
Move caches from `~/.config` to `~/.cache` and replace them with symlinks
#!/bin/env python3
from pathlib import Path
import shutil
import os
PATHS = (
"balena-etcher-electron/Cache",
"Code/Cache",
"Code/CachedData",
#!/bin/bash
function usage() {
cat >&2 <<EOF
Usage: $0 qa|dev
EOF
exit 1
}
[ $# -lt 1 ] && usage
@andreyfedoseev
andreyfedoseev / timeit_bisect.py
Created December 6, 2014 14:45
Test the complexity of Python bisect module
S = """
bisect.bisect_left(range({N}), {x})
"""
if __name__ == '__main__':
import timeit
from matplotlib import pyplot
Ns = []
@andreyfedoseev
andreyfedoseev / gist:3098411
Created July 12, 2012 14:20
Script to convert ArtsEdge XML data to CSV
import csv
from lxml import etree
FIELDS = (
"Ages",
"Assessments",
"Audiences",
"CreatedDate",
"Description",
@andreyfedoseev
andreyfedoseev / jquery.example.coffee
Created March 2, 2012 04:59
Boilerplate for jQuery plugin in CoffeeScript
class Widget
constructor: (@widget)->
@input.data("example-widget", @)
return
(($)->
$.fn.exampleWidget = (action, arg)->
@.each(->
$this = $(@)
@andreyfedoseev
andreyfedoseev / away.applescript
Created February 10, 2012 14:42
AppleScript to set Away status in Skype and Adium (for Alfred)
tell application "Adium" to go away
tell application "Skype"
send command "SET USERSTATUS DND" script name "Alfred"
end tell
@andreyfedoseev
andreyfedoseev / local_settings.py
Created July 28, 2011 15:53
Django settings to enable separate database for specified git branches
# This snippet allows to use separate databases for specified git branches.
# These databases are created automatically as copies of the default database.
# It works only with PostgreSQL.
# If you use password to connect to your database you should add it to ~/.pgpass file!
# Add this to your local settings file.
from settings import *
import os, shlex, subprocess