Skip to content

Instantly share code, notes, and snippets.

""" CouchDB Wrapper Class
This is based on an example wrapper class found in
http://wiki.apache.org/couchdb/Getting_started_with_Python.
TODO:
* Support Keep-Alive
"""
import httplib
// 環境
// gcc version 4.5.1 (Gentoo 4.5.1 p1.1, pie-0.4.5)
// boost 1.44.0
#include <boost/iterator/iterator_facade.hpp>
#include <boost/utility.hpp>
#include <boost/range/sub_range.hpp>
@yuttie
yuttie / print.ancestor.envs
Created December 20, 2010 08:08
trace and print caller's parent environment recursively
print.ancestor.envs <- function(e = environment(), level = 0) {
if (!identical(e, emptyenv())) {
print.ancestor.envs(parent.env(e), level - 1)
}
cat(sprintf("%3d: %s\n", level, environmentName(e)))
}
@yuttie
yuttie / gist:1006419
Created June 3, 2011 14:31
eskk用ACT変換テーブル
autocmd User eskk-initialize-pre call s:eskk_initial_pre()
function! s:eskk_initial_pre()
let t = eskk#table#new('rom_to_hira*', 'rom_to_hira')
" from ddskk
call t.add_map('~', '~')
call t.add_map('z ', ' ')
call t.add_map('z/', '・')
call t.add_map('z{', '【')
call t.add_map('z}', '】')
@yuttie
yuttie / gist:1025271
Created June 14, 2011 16:29
awesome: Key bindings and a function for placing a current window on the specified edge (tested with awesome-3.4.8)
-- Place a window on the specified edge of a screen
function place_window_edge(c, h_pos, v_pos)
local g = c:geometry()
local wa = screen[c.screen].workarea
local max_x = wa.width - g.width
local max_y = wa.height - g.height
g.x = wa.x + (h_pos + 1) * max_x / 2
g.y = wa.y + (v_pos + 1) * max_y / 2
c:geometry(g)
end
#!/bin/sh
# This shell script makes symbolic links to Hiragino fonts and a map file
# which can be used with dvipdfmx to embed Hiragino fonts into PDFs.
fonts_dir=${HOME}/.fonts
texmf_fonts_dir=${HOME}/texmf/fonts/opentype/hiragino
dvipdfmx_dir=${HOME}/texmf/fonts/map/dvipdfmx
mkdir -p $texmf_fonts_dir
ln -sf "$fonts_dir/ヒラギノ明朝 Pro W3.otf" $texmf_fonts_dir/HiraMinPro-W3.otf
@yuttie
yuttie / .xpdfrc
Created September 25, 2011 06:27
Configuration of xpdf for viewing Japanese text on Gentoo.
cidToUnicode Adobe-Japan1 /usr/share/poppler/cidToUnicode/Adobe-Japan1
@yuttie
yuttie / test_with_cgi.hs
Created June 24, 2012 01:57
Problem of a large response content with the gzip middleware.
{-# LANGUAGE OverloadedStrings #-}
import qualified Data.ByteString.Lazy as B
import Data.Char
import Network.Wai
import Network.Wai.Handler.CGI (run)
import Network.Wai.Middleware.Gzip (gzip, def)
import Network.HTTP.Types (status200)
application _ = return $ responseLBS status200 [("Content-Type", "text/plain")]
content
@yuttie
yuttie / init-redmine
Created April 25, 2014 03:10
An init script for Redmine
#!/bin/bash
#
# redmine Redmine
#
# chkconfig: 2345 80 30
# description: Postfix is a Mail Transport Agent, which is the program \
# that moves mail from one machine to another.
# processname: thin
# pidfile: /var/run/redmine.pid
@yuttie
yuttie / user.js
Created June 9, 2015 13:40
Optimizations for Firefox on Linux
// Force-enable hardware acceleration.
// Setting MOZ_USE_OMTC=1 is necessary.
// http://en.librehat.com/blog/force-enable-hardware-acceleration-in-firefox-on-linux/
user_pref("webgl.force-enabled", true);
user_pref("layers.acceleration.force-enabled", true);
user_pref("layers.offmainthreadcomposition.enabled;true", true);
user_pref("layers.offmainthreadcomposition.async-animations", true);
// Force-enable Skia backend for Azure
// https://bugzilla.mozilla.org/show_bug.cgi?id=740200#c44