Skip to content

Instantly share code, notes, and snippets.

View joujiahe's full-sized avatar

Johnson Chou joujiahe

View GitHub Profile
@joujiahe
joujiahe / top_10_shell_commands.sh
Created June 27, 2013 13:41 — forked from hanksudo/top_10_shell_commands.sh
Show your top 10 shell commands
history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head
<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/home/ngocdaothanh/opt/tsung-ws-plugin/share/tsung/tsung-1.0.dtd">
<tsung loglevel="notice" version="1.0">
<clients>
<!-- Can't be IP -->
<client host="localhost" cpu="8"/>
<client host="t2" cpu="8"/>
<!--
<client host="t3" cpu="8"/>
<client host="t4" cpu="8"/>
@include text-overflow;
@include text-shadow(0 -1px 1px #21272B);
@include border-radius(2px, 2px);
@include border-bottom-left-radius(8px);
@include box-shadow(rgba(0, 0, 0, 0.05) 3px 3px 5px);
@include single-box-shadow(rgba(0, 0, 0, 0.075), 0, 0, 3px);
@include single-transition(opacity, 0.2s, linear, 0s);
@include background(linear-gradient($color-btn, darken($color-btn, 10%)));
@include background-image(linear-gradient(lighten($color-btn, 5%), darken($color-btn, 15%)));
@include background-image(none);
@joujiahe
joujiahe / gitflow-breakdown.md
Created June 15, 2016 04:01 — forked from JamesMGreene/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
git commit --allow-empty -m "Initial commit"
git checkout -b develop master

Connect to the remote repository

@joujiahe
joujiahe / url_to_drive.js
Created November 7, 2017 10:32 — forked from denilsonsa/url_to_drive.js
Google Apps Script to upload a file from an URL directly to Google Drive.
// url_to_drive.gs
// Google Apps Script
// Allows uploading a URL directly to Google Drive.
//
// Live link:
// https://script.google.com/macros/s/AKfycbzvhbHS4hnWPVBDHjQzZHA0qWq0GR-6hY7TbYsNto6hZ0MeAFZt/exec
//
// Source-code:
// https://gist.github.com/denilsonsa/8134679
// https://script.google.com/d/1Ye-OEn1bDPcmeKSe4gb0YSK83RPMc4sZJt79SRt-GRY653gm2qVUptoE/edit
@joujiahe
joujiahe / idbkeyrange_forprefix.js
Created July 20, 2018 01:56 — forked from inexorabletash/idbkeyrange_forprefix.js
Helper for creating an IDBKeyRange for all keys with a given prefix
// Basic p(r)olyfill for proposed feature
// This defines no successor of empty arrays, so the range for prefix
// [] or [[],[]] has no upper bound.
// An alternate definition would preclude adding additional nesting,
// so the range for prefix [] would have upper bound [[]] and the
// range for prefix [[], []] would have upper bound [[], [[]]].
IDBKeyRange.forPrefix = function(prefix) {
// Ensure prefix is a valid key itself:
@joujiahe
joujiahe / pdfimage
Created October 12, 2020 15:46 — forked from innermond/pdfimage
Extract images from pdf but, surprise! The images that contain alpha channels are extracted as two images. The source and the mask, as they are stored inside pdf file. This script recombine them into an one png file with given transparency
#/usr/bin/bash
# extract images from pdf at first-hand
#prefix=pict
#echo extract images from "$1"
#pdfimages -j "$1" $prefix
# IMAGES ARE SAVED SECVENTIALLY AS IMAGE AND THE NEXT IS A MASK IMAGE !!!!
declare -a files=($(ls *.ppm *.pbm))
mask=
image=
for (( i = 0; i < ${#files[*]}; i = i + 2 ))