Skip to content

Instantly share code, notes, and snippets.

@dylandy
dylandy / fcitx-chewing.png
Created February 28, 2018 14:26 — forked from tanyuan/fcitx-chewing.png
Ubuntu: fcitx + chewing 新酷音輸入法
fcitx-chewing.png
@dylandy
dylandy / vim_cheat_sheet.vim
Created November 25, 2016 10:45
vim cheat sheet
; to search and replace all origin_words from current document.
; 1,$ stands for from first line to last line.
:1,$ s/origin_word/replace_word/g
view_csv () { column -s , -t < "$1" | less -#2 -N -S; }
@dylandy
dylandy / html2pdf.js
Created July 14, 2016 14:00
convert from html to pdf
var fs = require('fs');
var pdf = require('html-pdf');
var args = process.argv;
var htmlfile = args[2];
var pdffile = args[3];
if(htmlfile === undefined || pdffile === undefined) {
console.error('You must supply a html filename, and then a PDF filename.');
process.exit();
1. rsruby gem install
=> gem install rsruby -- --with-R-home=/usr/lib/R --with-R-include=/usr/share/R/include #Linux
=> gem install rsruby -- --with-R-include=/usr/share/R/include --with_cflags="-fPIC -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wall -fno-strict-aliasing" #Linux
=> gem install rsruby -- --with-R-dir=$R_HOME --with-R-include=$R_HOME/include --with-R-lib=$R_HOME/lib # All platform
@dylandy
dylandy / .bash_profile
Created January 2, 2015 07:59
bash_profile for mac
# Change Prompt
# ------------------------------------------------------------
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
PS1+='${debian_chroot:+($debian_chroot)}'
PS1+='\[\033[01;34m\]$(__git_ps1)\[\033[00m\]'
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
@dylandy
dylandy / response_gender.rb
Created December 11, 2014 04:18
Dcard 回應男女比
require 'rubygems'
require 'json'
require 'open-uri'
start_at = 20000
end_at = JSON.load(open("http://www.dcard.tw/api/forum/all/1/"))[0]["id"]
gender = []
(start_at..end_at).each do |i|
begin
@dylandy
dylandy / count_boy_girl.rb
Last active August 29, 2015 14:11
Dcard 發文男女比
require 'rubygems'
require 'json'
require 'open-uri'
module Counter
def self.go!
count()
end
def self.count
gender = []
@dylandy
dylandy / bashrc
Last active December 28, 2015 16:49 — forked from float-tw/bashrc
color man and modified title to show git branch
# two line prompt (show git branch)
PS1='\n\[\033[01;30m\]┌[\[\033[00m\]'
PS1+='${debian_chroot:+($debian_chroot)}'
PS1+='\[\033[01;32m\]\u\[\033[00m\]@\h'
PS1+='\[\033[01;30m\]]\[\033[00m\]:'
PS1+='\[\033[01;33m\]\w\[\033[00m\]'
PS1+='\[\033[01;34m\]$(__git_ps1)\[\033[00m\]'
PS1+='\n\[\033[01;30m\]└─\[\033[00m\]\$ '
# For colourful man pages (CLUG-Wiki style)