Skip to content

Instantly share code, notes, and snippets.

Moving stuff into GitHub!

Jindi Wu kymair

Moving stuff into GitHub!
Block or report user

Report or block kymair

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:ce30789bf5031b589e0fda39e01ce045
for file in *.html;do pandoc $file -f html -t plain -o ${file%.*}.md; done
kymair /
Created Aug 22, 2014
Ubuntu in VirtualBox
# Configure APT
sudo sed -i '%s/' /etc/apt/sources.list
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential
# Install VirtualBox addons
sudo mount -t auto /dev/cdrom /media/cdrom
cd /media/cdrom
sudo ./
View gist:cdb26b409fa7e385c820
/* Bit Wtiddling Hacks
java.util.ArrayDeque - find the nearest power of two */
private void allocateElements(int numElements) {
int initialCapacity = MIN_INITIAL_CAPACITY;
// Find the best power of two to hold elements.
// Tests "<=" because arrays aren't kept full.
if (numElements >= initialCapacity) {
initialCapacity = numElements;
initialCapacity |= (initialCapacity >>> 1);
View gist:8574867
# build-essential in CentOS
sudo yum groupinstall 'Development Tools'
for ((idx = 0; idx < $CONCURRENCY; idx++))
time echo "scale=5000; a(1)*4" | bc -l > /dev/null &
echo "$TIME_START Start"
kymair /
Last active Jul 12, 2018
Python script to update Linode DNS
# Get Linode API python bindings from
from linode import api
instance = api.Api(key='abcdefg')
for domain in instance.domain_list():
if domain['TYPE'] == 'master':
print "Updating %s (%i)..." % (domain['DOMAIN'], domain['DOMAINID'])
View gist:4361955
# Create a temp big file on server
kymair:wwwroot/ $ dd if=/dev/zero bs=1M count=100
# wget that file from client, two connections at the same time
~ wget > /dev/null 2&>1 &
[1] 79229
~ wget > /dev/null 2&>1 &
[2] 79234
# Client netstat result
kymair / mailbox_cleaner.rb
Created Dec 18, 2012
Handy Ruby script to empty IMAP mailbox
View mailbox_cleaner.rb
#!/usr/bin/env ruby
MAILBOXES = ['INBOX', 'Deleted Items']
SERVER = 'server'
USERNAME = 'username'
PASSWORD = 'password'
require 'net/imap'
imap =
kymair / file1.clj
Created Jul 31, 2012
Read and write file in Clojure
View file1.clj
(use '[clojure.string :only [split]])
(require '[ :as io])
(def format-str "%1$-255s%2$09d%3$-255s%4$-1000s%5$-1s")
(defn format-line
(let [[v1 v2 v3 v4 v5] (split line #",")]
(format format-str v1 (read-string v2) v3 v4 v5)))
kymair / ldapper.clj
Last active Oct 7, 2015
Update LDAP password
View ldapper.clj
(ns ldapper.core
(:require [clj-ldap.client :as ldap]
[clj-message-digest.core :as cdigest])
(def server (ldap/connect {:host "server:3997" :bind-dn "cn=Directory Manager" :password "password"}))
(def base-dn "ou=people,")
(defn- hash-password
You can’t perform that action at this time.