Skip to content

Instantly share code, notes, and snippets.

View arrowrowe's full-sized avatar

arrowrowe arrowrowe

View GitHub Profile
@arrowrowe
arrowrowe / share.py
Last active November 26, 2017 05:44
#!/usr/bin/env python3
from pyqrcode import QRCode
import json
import sys
import base64
def load_json(path):
with open(path, 'r') as r:
return json.loads(r.read())
@arrowrowe
arrowrowe / arrowrowe.ahk
Last active October 15, 2016 18:00
A AutoHotKey Configuration File
Capslock::Ctrl
LCtrl::Capslock
; ----------------------- ----------------------- -----------------------
; Chrome
; ----------------------- ----------------------- -----------------------
; Switch between tabs
LAlt & ,::Send ^+{TAB}
LAlt & .::Send ^{TAB}
@arrowrowe
arrowrowe / arrowrowe.zsh-theme
Last active October 11, 2016 12:06
ZSH theme based on robbyrussell.zsh-theme.
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)"
local pwd="$fg_bold[cyan]%d$reset_color"
local signature="$fg_no_bold[green]$(print "$(whoami)@$(uname -n)")$reset_color"
local NEWLINE=$'\n'
PROMPT="${ret_status} $signature $pwd\$(git-radar --zsh --fetch 2>&1) $NEWLINE$ "
@arrowrowe
arrowrowe / .zshrc
Last active August 6, 2016 07:08
ZSH configuration of @arrowrowe.
# Common
alias c='clear'
alias rp='cd $(realpath .)'
alias clip='xclip -sel clip'
alias o='xdg-open'
mkd() { mkdir -p $1; cd $1 }
mvi() { mv $1 $2; vi $2 }
cpi() { cp $1 $2; vi $2 }
@arrowrowe
arrowrowe / pixiv-rank.js
Created May 9, 2016 11:36
Given a rank of a day, find the right work on Pixiv.
/*** Dependencies ************************************************************/
const Promise = require('bluebird');
const jsEnv = Promise.promisify(require('jsdom').env);
/*** The Function ************************************************************/
const getLinksByRank = (date, rank) =>
jsEnv('http://www.pixiv.net/ranking.php?mode=daily&date=' + date)
.then(window => window.document.getElementById(rank).getElementsByClassName('work')[0].href)
.then(jsEnv)
.then(window => window.document.getElementsByClassName('_work')[0].getElementsByTagName('img')[0].src)
@arrowrowe
arrowrowe / count-non-english-characters-in-files-matching-a-given-pattern.md
Last active May 4, 2016 10:13
Count Non-English Characters in Files Matching a Given Pattern

Count Non-English Characters

In Files Matching a Given Pattern.

Install

Install Node >= v6 and replem.

Usage

@arrowrowe
arrowrowe / html-assets-plugin.js
Created February 7, 2016 18:12
A Webpack plugin for addressing javascripts (especially when hashed) in HTML.
/*
HtmlAssetsPlugin
Require: fs-extra, glob
Usage:
In webpack.config.js, add this plugin.
new HtmlAssetsPlugin('glob/for/all/html/like/*.html')
In HTMLs, list all entries (including common if exists). Prefix '@' can be customed.
<script type="text/javascript" src="@commons"></script>
@arrowrowe
arrowrowe / CmdInit.cmd
Created October 15, 2015 10:43
Customize Windows command line environment.
doskey l=dir /Q
doskey ls=dir /W
@arrowrowe
arrowrowe / ubuntu.init
Last active September 12, 2015 07:59
Initialize a new Ubuntu.
#!/bin/bash
#### Necessary Update ###################
sudo apt-get update
#### Oh My ZSH ##########################
sudo apt-get -y install zsh git-core
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh
chsh -s `which zsh`