Skip to content

Instantly share code, notes, and snippets.

Avatar

Vincent Tsai Vayn

View GitHub Profile
View parser.rs
#![allow(dead_code)]
#[derive(Clone, Debug, PartialEq, Eq)]
struct Element {
name: String,
attributes: Vec<(String, String)>,
children: Vec<Element>,
}
/// Time For A Trait
@Vayn
Vayn / connectHTMLelements_SVG.png
Created May 6, 2019 — forked from alojzije/connectHTMLelements_SVG.png
Connect two elements / draw a path between two elements with SVG path (using jQuery)
@Vayn
Vayn / map_lctrl_plus_open_bracket_to_esc.json
Created Sep 4, 2018
Map Left-Control+Open-Bracket to Escape (Karabiner-Elements)
View map_lctrl_plus_open_bracket_to_esc.json
{
"title": "Map Left-Control+Open-Bracket to Escape",
"rules": [
{
"manipulators": [
{
"description": "Bracket Rule [left_control + open_bracket]",
"type": "basic",
"from": {
"key_code": "open_bracket",
@Vayn
Vayn / README.md
Created May 13, 2017 — forked from jasonm23/README.md
Elixir mix oh-my-zsh completion plugin
View README.md

Elixir Mix Oh-My-Zsh plugin

Copy the folder ./elixir_mix/ to ~/.oh-my-zsh/custom/plugins/ and add _elixir_mix to your .zshrc plugins list. e.g.

Example:

plugins=(
  autojump
  git
@Vayn
Vayn / gist:ee855901f2626aee9d5ceb5b3ae7b7d8
Last active Dec 10, 2016 — forked from hzlzh/gist:eb87294712e78d4a96c4
Proxifier 走代理程序请求规则
View gist:ee855901f2626aee9d5ceb5b3ae7b7d8
iTerm2; curl; git-remote-https; helpd; "Alfred 3"; idea; Thunder*; Terminal; php; Dropbox; Sparrow; "Sequel Pro"; python; python3; ruby; wget; GitHub; npm; node; perl; prl*; itunes; sftp; whois; traceroute; stroke; ssh; MacUpdate*; git*; Git; fzs*; mail; flickr*; xulr*; imess*; com.apple.im*; Airmail; Adium; Prot*; Tokens; Lite*; file*; ssh; ftp; Adobe*; PDApp*; Creative*; Vbox*; xulrunner; Virtual*; PDApp; Bit*; Domainers; fire*; plugin*; Atom*; Tokens; .com.realmacsoftware*; Xcode; java; httpd; Amethyst; Moom;
@Vayn
Vayn / translatekeycodes.swift
Created Nov 13, 2016 — forked from ArthurYidi/translatekeycodes.swift
virtual key codes to unicode characters
View translatekeycodes.swift
func keyCodeToString(keyCode: CGKeyCode) -> String {
let curKeyboard = TISCopyCurrentKeyboardInputSource().takeRetainedValue()
let ptr = TISGetInputSourceProperty(curKeyboard, kTISPropertyUnicodeKeyLayoutData)
let keyboardLayoutPtr = UnsafePointer<UCKeyboardLayout>(ptr)
var deadKeyState: UInt32 = 0
var actualStringLength = 0
var unicodeString = [UniChar](count: 255, repeatedValue: 0)
let status = UCKeyTranslate(keyboardLayoutPtr,
@Vayn
Vayn / trans_gif.sh
Created Nov 1, 2016 — forked from venj/trans_gif.sh
convert video to gif
View trans_gif.sh
#!/bin/sh
# Convert video to gif.
if [[ $# -ne 3 ]]; then
echo "Usage: trans_gif source.mp4 target.gif 300"
exit 1
fi
palette="/tmp/palette.png"
filters="fps=15,scale=$3:-1:flags=lanczos"
View survey_cracker.js
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
var radios = Array.prototype.slice.call(document.querySelectorAll(".css-radio"))
var goods = radios.filter(function(element) {
return element.value >= 5;
});
for(var i = 0; i < goods.length; i++) {
@Vayn
Vayn / gunicorn_start.sh
Created Oct 9, 2016
Django+Supervisor+Gunicorn
View gunicorn_start.sh
#!/bin/bash
NAME="myproject"
VIRTURLROOT=/home/ubuntu/.virtualenvs/hezhi
DJANGODIR=/var/www/hezhi
SOCKFILE=/var/www/hezhi/run/gunicorn.sock
USER=ubuntu
GROUP=ubuntu
NUM_WORKERS=3
DJANGO_SETTINGS_MODULE=hezhi.settings.dev
@Vayn
Vayn / gunicorn_start.sh
Last active Oct 1, 2016
django, gunicorn, supervisor, virtualenvwrapper settings
View gunicorn_start.sh
#!/bin/bash
NAME="hezhi" # Name of the application
PYTHONPATH=/home/ubuntu/.virtualenvs/hezhi/bin/python3 # Python path
DJANGODIR=/var/www/hezhi # Django project directory
SOCKFILE=/var/www/hezhi/run/gunicorn.sock # we will communicte using this unix socket
USER=ubuntu # the user to run as
GROUP=ubuntu # the group to run as
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn
DJANGO_SETTINGS_MODULE=hezhi.settings # which settings file should Django use, change to
You can’t perform that action at this time.