Skip to content

Instantly share code, notes, and snippets.

@bamanzi
bamanzi / firefox-prefs.js.md
Last active May 19, 2023 09:34
Firefox preference tweaks
@bamanzi
bamanzi / gist:3121820
Created July 16, 2012 09:32
Extract notes' title & url from Evernote exported file (*.enex)
from lxml import etree
def enex_list_notes_info(enex_file_name):
f = file(enex_file_name, "r")
enex = etree.parse(f)
notes = enex.xpath("//note")
for note in notes:
title = url = ""
etitle = note.xpath("title")
@bamanzi
bamanzi / zshrc.sh
Created April 1, 2014 11:25
zshrc
#** prompt
autoload -Uz promptinit
promptinit
prompt adam1
#** completion
# Use modern completion system
autoload -Uz compinit
compinit
@bamanzi
bamanzi / zsh-git-prompt.sh
Created June 27, 2013 09:43
zsh: show git repo name, branch in right prompt
# although StackOverflow has this answer http://stackoverflow.com/a/1128583
# but that code is unreadable, thus I have this (also based on a SO anower: http://stackoverflow.com/a/1128721 )
# get the name of the branch we are on
_git_repo_name() {
gittopdir=$(git rev-parse --git-dir 2> /dev/null)
if [[ "foo$gittopdir" == "foo.git" ]]; then
echo `basename $(pwd)`
elif [[ "foo$gittopdir" != "foo" ]]; then
echo `dirname $gittopdir | xargs basename`
@bamanzi
bamanzi / tc-tango.ini
Created June 15, 2012 09:50
Tango theme for Total Commander
[COLORS]
BackColor=3421230
ForeColor=12500670
MarkColor=9125192
CursorColor=5237247
BackColor2=1973790
InverseCursor=0
CursorText=-1
InverseSelection=1
@bamanzi
bamanzi / ediff.py
Created June 13, 2012 01:47
[emacs] ediff command line launcher
#!/usr/bin/python
# on windows, you can use cx-freeze to make an exe for this
import os
import os.path
import sys
if len(sys.argv)<3:
sys.stderr.write("Usage: ediff file1 file2")
else:
@bamanzi
bamanzi / chroot.sh
Last active May 16, 2018 19:56
chroot wrapper
NEWROOT=`dirname $(readlink -f $0)`
read -n1 -p "chroot to $NEWROOT? (y/n) :" ack
[ foo"$ack" == fooy ] || exit -1
echo " "
function mount_if_not() {
dir=$1
mount | grep $NEWROOT$dir >/dev/null
@bamanzi
bamanzi / tango-theme.properties
Created June 15, 2012 09:51
Tango theme for SciTE
[general]
color.butter-1=#fce94f
color.butter-2=#edd400
color.butter-3=#c4a000
color.orange-1=#fcaf3e
color.orange-2=#f57900
color.orange-3=#ce5c00
color.choc-1=#e9b96e
color.choc-2=#c17d11
color.choc-3=#8f5902
@bamanzi
bamanzi / jed-extra-parts.dot
Created July 12, 2017 06:46
some useful packages (that don't need extra slang-modules) in jed-extra
digraph jed_extra {
node [style=filled ];
ffap [color=deepskyblue];
hyperman [color=deepskyblue];
info [color=deepskyblue];
hyperhelp [color=deepskyblue];
tokenlist [color=deepskyblue];
grep [color=deepskyblue];
@bamanzi
bamanzi / percol-finder-pinyin.py
Last active February 27, 2017 04:37
add 'pinyin' matching method to percol
# This add a new matching method 'pinyin' to percol(https://github.com/mooz/percol)
# In this matching method, first char of each Chinese character's pinyin sequence is used for matching.
# For example, 'zw' matching '中文' (ZhongWen), '中午'(ZhongWu), '作为' (ZuoWei) etc.
# Usage:
# percol --match-method pinyin SomeFileContainingChinese.txt
class FinderMultiQueryPinyin(FinderMultiQuery):
def get_name(self):
return "pinyin"