Skip to content

Instantly share code, notes, and snippets.

Avatar

arrowrowe arrowrowe

View GitHub Profile
View share.py
#!/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 / pixiv-rank.js
Created May 9, 2016
Given a rank of a day, find the right work on Pixiv.
View pixiv-rank.js
/*** 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
Count Non-English Characters in Files Matching a Given Pattern
View count-non-english-characters-in-files-matching-a-given-pattern.md

Count Non-English Characters

In Files Matching a Given Pattern.

Install

Install Node >= v6 and replem.

Usage

@arrowrowe
arrowrowe / html-assets-plugin.js
Created Feb 7, 2016
A Webpack plugin for addressing javascripts (especially when hashed) in HTML.
View html-assets-plugin.js
/*
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 Oct 15, 2015
Customize Windows command line environment.
View CmdInit.cmd
doskey l=dir /Q
doskey ls=dir /W
@arrowrowe
arrowrowe / ubuntu.init
Last active Sep 12, 2015
Initialize a new Ubuntu.
View ubuntu.init
#!/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`
@arrowrowe
arrowrowe / arrowrowe.zsh-theme
Last active Oct 11, 2016
ZSH theme based on robbyrussell.zsh-theme.
View arrowrowe.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 Aug 6, 2016
ZSH configuration of @arrowrowe.
View .zshrc
# 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 / arrowrowe.ahk
Last active Oct 15, 2016
A AutoHotKey Configuration File
View arrowrowe.ahk
Capslock::Ctrl
LCtrl::Capslock
; ----------------------- ----------------------- -----------------------
; Chrome
; ----------------------- ----------------------- -----------------------
; Switch between tabs
LAlt & ,::Send ^+{TAB}
LAlt & .::Send ^{TAB}
You can’t perform that action at this time.