Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / firefox-prefs.js.md
Last active May 19, 2023 09:34
Firefox preference tweaks
@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 / 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 / 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 / no-cedet-imenu.el
Created August 9, 2012 14:05
[emacs] get rid of cedet's imenu creator
(defun bmz/restore-imenu-index-function ()
"Restore `imenu-create-index-function' for current major-mode.
Note this would reset to `imenu-default-create-index-function', but some modes
have its own implementation."
(interactive)
(let* ((func-name (cond
((eq major-mode 'python-mode)
'python-imenu-create-index)
((eq major-mode 'js2-mode)
@bamanzi
bamanzi / projectile-anything.el
Created August 23, 2012 08:36
projectile-anything.el
(require 'projectile)
(require 'anything)
;; helper for anything
(defun anything-c-projectile-files ()
"Generates a list of files in the current project"
(projectile-get-project-files
(projectile-get-project-root)))
(defvar anything-c-source-projectile-files
@bamanzi
bamanzi / gist:3774144
Created September 24, 2012 04:07
check whether all notes in evernote3 are migrated to 3 to 4
# coding: utf-8
# check whether all notes in evernote3 are migrated to 3 to 4
# 1. open an evernote 4.x database (sqlite)
# 2. open an evernote 3.x export (.enex)
# 3. check for each note in enex, if not in evernote 4 database, then print out the title
import sqlite3
from lxml import etree
@bamanzi
bamanzi / gist:3945989
Created October 24, 2012 13:15
Dreampie configuration causing this bug https://github.com/noamraph/dreampie/issues/3
[DreamPie]
show-getting-started = False
font = Courier New 10
current-theme = Dark
pprint = True
use-reshist = True
reshist-size = 30
autofold = True
autofold-numlines = 30
viewer = ''