Skip to content

Instantly share code, notes, and snippets.

View ento's full-sized avatar

ento

View GitHub Profile
@ento
ento / gist:849569
Created March 1, 2011 18:11
My latest .emacs
;(global-set-key "\C-h" 'backward-delete-char)
;
;(global-font-lock-mode t)
;(setq transient-mark-mode t)
;(set-face-background 'region "indianred")
;(tool-bar-mode 0)
;(show-paren-mode t)
;(setq w3m-home-page "http://www.google.com")
@ento
ento / gist:875768
Created March 18, 2011 08:16
MySQL popcount
SELECT LENGTH(REPLACE(BIN(7), '0', ''));
@ento
ento / buildlibxml.diff
Created March 19, 2011 13:54
Installing lxml on a Mac OS X 10.6 that has no PPC support (read: Xcode 4)
diff --git a/buildlibxml.py b/buildlibxml.py
index bfcf3e4..7bf36e5 100644
--- a/buildlibxml.py
+++ b/buildlibxml.py
@@ -284,8 +284,11 @@ def build_libxml2xslt(download_dir, build_dir,
})
else:
env.update({
- 'CFLAGS' : "-arch ppc -arch i386 -arch x86_64 -O2",
- 'LDFLAGS' : "-arch ppc -arch i386 -arch x86_64",
@ento
ento / gist:903098
Created April 5, 2011 05:57
Steps to install pep8 pre-commit hook managed by git-hooks
# Repository developers
cd /path/to/somewhere
git clone https://github.com/kergoth/git-hooks
export PATH=/path/to/somewhere/git-hooks:$PATH
cd /path/to/project
git hooks --install
@ento
ento / gist:960370
Created May 7, 2011 09:43
Add homebrew.pth to activate Python packages installed with homebrew
echo '/usr/local/lib/python2.6/site-packages/' | sudo tee /Library/Python/2.6/site-packages/homebrew.pth
@ento
ento / se-better-search-animation.user.js
Created August 10, 2011 17:27 — forked from NickCraver/se-disable-search-animation.user.js
Stack Exchange search box animation disabler
// ==UserScript==
// @name Stack Exchange search box grower 1.0
// @namespace stackoverflow
// @description Make Stack Exchange search box grow incrementally
// @include http://stackoverflow.com/*
// @include http://*.stackoverflow.com/*
// @include http://*.stackexchange.com/*
// @include http://serverfault.com/*
// @include http://superuser.com/*
// @include http://stackapps.com/*
@ento
ento / getting-phantomjs-working-on-centos55.md
Last active September 26, 2015 18:47 — forked from niteria/getting-phantomjs-working-on-centos55.txt
Building phantomjs on CentOS 5.5
@ento
ento / 1st access
Created October 27, 2011 02:53
JLU Question is inacessible due to invalid utf-8 character in a title: HTTP request/response headers recorded by Google Chrome
Request URL:http://japanese.stackexchange.com/questions/1472/pronunciation-and-meaning-of-%EE%93%BB
Request Method:GET
Status Code:301 Moved Permanently
Request Headers
GET /questions/1472/pronunciation-and-meaning-of-%EE%93%BB HTTP/1.1
Host: japanese.stackexchange.com
Connection: keep-alive
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.102 Safari/535.2
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
@ento
ento / gist:1525902
Created December 28, 2011 02:37
Calculate the total length of music/sound files in a folder
import re
import glob
import commands
duration_re = re.compile(r'(?P<hour>\d+):(?P<minute>\d+):(?P<second>\d+\.\d+),')
hour = minute = second = 0.0
for f in glob.glob("./*"):
s = commands.getstatusoutput('ffmpeg -i %s 2>&1 | egrep "Duration" | cut -d " " -f 4' % f)[1]
m = duration_re.match(s)
@ento
ento / pymongo.py
Created March 30, 2012 00:56
Flask-PyMongo datastore for Flask-Admin
# -*- coding: utf-8 -*-
from flask.ext.admin import datastore
from flask.ext.admin import util
from flask.ext.wtf import Form
from pymongo.objectid import ObjectId
from pymongo.errors import OperationFailure
class Any(object):