Skip to content

Instantly share code, notes, and snippets.

View yiwang's full-sized avatar

Yi Wang yiwang

View GitHub Profile
/**
* Javascript port of Clojure's flavor of Murmur3.
* See https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Murmur3.java
*
* Find at: https://gist.github.com/favila/9088146
* By favila (Francis Avila) 2014-02-19
*/
goog.provide('cljs.lang.murmur3');
goog.require('cljs.core');
-- Related blog post to this Gist:
-- https://torsten.io/stdout/expanding-json-arrays-to-rows
-- Run these commands on a interactive RedShift session:
CREATE TEMP TABLE clusters AS (
SELECT 1 AS id, '[1, 2]' AS node_sizes UNION ALL
SELECT 2 AS id, '[5, 1, 3]' AS node_sizes UNION ALL
SELECT 3 AS id, '[2]' AS node_sizes
);
VIM and Clojure:
The current steps might be (intended for vim beginners).
0A. Install Pathogen for easy vim installation (optional)
- https://github.com/tpope/vim-pathogen
- http://www.vim.org/scripts/script.php?script_id=2332
0B. Install new version of static runtime editing (optional, only if latest version is needed)
- https://github.com/guns/vim-clojure-static
#!/bin/bash -ex
# Paste this into ssh
# curl -sL https://gist.github.com/andsens/2913223/raw/bootstrap_homeshick.sh | tar -xzO | /bin/bash -ex
# When forking, you can get the URL from the raw (<>) button.
### Set some command variables depending on whether we are root or not ###
# This assumes you use a debian derivate, replace with yum, pacman etc.
aptget='sudo apt-get'
chsh='sudo chsh'

Set up screen

  1. docker run --detach --interactive --tty --privileged --net=host fedora /bin/bash
  2. docker attach $CONTAINER_ID
  3. yum install screen

Create screen session

  1. docker attach $CONTAINER_ID
  2. screen -S test
  3. Detach from screen
#!/usr/bin/env python
# coding=utf8
# author=evi1m0
# website=linux.im
'''
12306 Captcha Picture:
author: Evi1m0@20150316
1. Download Captcha
2. Pic Conver Text
@yiwang
yiwang / shellout.py
Created December 22, 2015 21:48 — forked from miku/shellout.py
shellout
def shellout(template, **kwargs):
"""
Takes a shell command template and executes it. The template must use
the new (2.6+) format mini language. `kwargs` must contain any defined
placeholder, only `output` is optional.
Raises RuntimeError on nonzero exit codes.
Simple template:
wc -l < {input} > {output}
@yiwang
yiwang / springer-free-maths-books.md
Created December 28, 2015 18:05 — forked from bishboria/springer-free-maths-books.md
Springer have made a bunch of maths books available for free, here are the direct links
@yiwang
yiwang / statsd.md
Created February 23, 2016 18:42 — forked from trusche/statsd.md
Installing graphite and statsd on OS X Yosemite

Prerequisites

  • Homebrew
  • Python 2.7
  • Git

Graphite

Install Cairo

There's an issue with cairo 14.x that results in the axis fonts on the graphs being HUUUUUGE. Downgrading to 12.6 helps: