Skip to content

Instantly share code, notes, and snippets.

inoremap ( <c-r>=OpenPair('(')<CR>
inoremap ) <c-r>=ClosePair(')')<CR>
inoremap { <c-r>=OpenPair('{')<CR>
inoremap } <c-r>=ClosePair('}')<CR>
inoremap [ <c-r>=OpenPair('[')<CR>
inoremap ] <c-r>=ClosePair(']')<CR>
" just for xml document, but need not for now.
"inoremap < <c-r>=OpenPair('<')<CR>
"inoremap > <c-r>=ClosePair('>')<CR>
function! OpenPair(char)
@doitian
doitian / amimport
Created December 17, 2010 14:00
Batch import ED2K links to amule
#!/usr/bin/env python
amule_dir = "~/.aMule"
# Usage:
#
# Update amule_dir to your real location.
#
# The file or stdin must have one ED2K link per line.
#
# 1. Import file
#
@smoser
smoser / README.md
Last active October 12, 2020 17:14
ubuntu-auto-install: install a ubuntu image with kvm

Ubuntu Auto Install

This allows user to do automated installation of ubuntu. Provided here a a few different files/scripts for making this easier.

I've used this to verify that d-i kernel and initramfs from -proposed work as shown in bug 1511497.

The provided 'preseed' below can be used as a fully automated installation of ubuntu. Boot with qemu like:

note python web server is useful for this (python -m SimpleHTTPServer 9999)

@holin
holin / nginx.conf
Created October 26, 2011 02:27 — forked from samqiu/nginx.conf
Nginx http proxy cache to mirror of Rubygems.org
# 在本地服务器建立 rubygems.org 的镜像缓存,以提高 gem 的安装速度
# 此配置设置缓存过期为1天,也就是说,新上的 gem 无法马上安装
# 做这个起什么作用?
# rubygems 的很多资源文件是存放到 Amazon S3 上面的,由于 GFW 对某些 S3 服务器又连接重置或丢包,导致 gem 安装异常缓慢或有时候根本无法连接安装。
# 而通过这种跳板的方式可以很好的解决这个问题,当然前提是 Nginx反向代理 服务器需要在国外
proxy_cache_path /var/cache/rubygems levels=1:2 keys_zone=RUBYGEMS:10m
inactive=24h max_size=1g;
server {
listen 80;
@josch
josch / debconf-selections.txt
Created November 11, 2011 09:49
debconf installer preseed
# Services to use:
# Choices: security updates (from security.debian.org), volatile updates (from volatile.debian.org)
apt-setup-udeb apt-setup/services-select multiselect
# Non-existing physical volume
partman-auto-lvm partman-auto-lvm/no_such_pv error
# Check the integrity of another CD-ROM?
d-i cdrom-checker/nextcd boolean false
# Install GRUB?
grub-installer grub-installer/grub_not_mature_on_this_platform boolean false
@doitian
doitian / my-folding.el
Created January 6, 2012 15:56
set up a comfortable emacs folding
(defvar fringe-face 'fringe)
(custom-set-variables
'(folding-font-lock-begin-mark 'fringe-face)
'(folding-font-lock-end-mark 'fringe-face))
(defface collapsed-face '((t (:background "#e0cf9f" :foreground "#5f5f5f"))) "Collapsed Overlay")
(defvar collapsed-face 'collapsed-face)
(require 'folding)
(setq folding-check-folded-file-function 'iy-folding-check-folded)
(folding-mode-add-find-file-hook)
@Thermionix
Thermionix / grub.cfg
Last active June 7, 2021 17:47
grub2 loopback multiboot flash drive
moved to https://github.com/Thermionix/multipass-usb
@c00kiemon5ter
c00kiemon5ter / monsterwm2bar
Created February 25, 2012 02:40
monsterwm output to dzen2 or some_sorta_bar
ff="/tmp/monsterwm.fifo"
[[ -p $ff ]] || mkfifo -m 600 "$ff"
# desktop names
ds=("web" "dev" "foo" "null")
# layout names
ms=("T" "M" "B" "G" "F")
while read -t 60 -r wmout || true; do
@robinsmidsrod
robinsmidsrod / _INSTALL.md
Last active June 16, 2024 09:00
Bootstrapping full iPXE native menu with customizable default option with timeout (also includes working Ubuntu 12.04 preseed install)

Add the following chunk to your existing ISC dhcpd.conf file.

if exists user-class and ( option user-class = "iPXE" ) {
    filename "http://boot.smidsrod.lan/boot.ipxe";
}
else {
    filename "undionly.kpxe";
}

(or see https://gist.github.com/4008017 for a more elaborate setup

@kleinig
kleinig / debmirror.sh
Created July 14, 2012 11:40
debmirror script
#!/bin/sh
DEBMLOG=/pool/debmirror/debmirror.log
MIRRORDIR=/pool/debmirror
BANDWIDTH=500
if test -s $DEBMLOG
then
test -f $DEBMLOG.3.gz && mv $DEBMLOG.3.gz $DEBMLOG.4.gz
test -f $DEBMLOG.2.gz && mv $DEBMLOG.2.gz $DEBMLOG.3.gz