Skip to content

Instantly share code, notes, and snippets.

View danielglh's full-sized avatar

Linghui Gong danielglh

View GitHub Profile
### Keybase proof
I hereby claim:
* I am danielglh on github.
* I am danielglh (https://keybase.io/danielglh) on keybase.
* I have a public key ASDGFtnpVet7dp52MuG9fKoDGpA08m1_HUBdF4pF4hT8Kgo
To claim this, I am signing this object:
@danielglh
danielglh / lambda.js
Created February 22, 2017 09:18
Image Transformation with AWS Lambda
"use strict";
// Dependencies
const async = require("async");
const gm = require("gm").subClass({
imageMagick: true
});
const aws = require("aws-sdk");
const s3 = new aws.S3();
@danielglh
danielglh / pragpub.rb
Last active November 1, 2020 21:32
Download All Free PragPub Magazines
# PragPub magazines offer the first 49 issues for free here: https://pragprog.com/magazines.
# This script allows you to download all these free issues.
# For newer issues, you have to purchase them here: http://theprosegarden.com/.
require 'open-uri'
require 'open_uri_redirections'
def download_issue(num)
num = num.to_s.rjust(3, "0")
dir = "issue.#{num}"
@danielglh
danielglh / .tmux.conf
Last active January 16, 2022 16:01
My Tmux Configuration
set -g prefix ^k
unbind ^b
bind a send-prefix
unbind '"'
bind - splitw -v # vertical split
unbind %
bind | splitw -h # horizonal split
bind k selectp -U # select the up window
@danielglh
danielglh / config.txt
Created November 29, 2013 13:50
Use this to replace /boot/config.txt on raspbian to fix resolution issue.
arm_freq=840
core_freq=375
disable_overscan=1
gpu_mem_256=100
gpu_mem_512=100
sdram_freq=400
over_voltage=0
@danielglh
danielglh / pg_helper
Created August 31, 2013 03:00
pg_helper
pg() {
if [[ $@ == "log" ]]; then
command less /usr/local/var/postgres/default/server.log
elif [[ $@ == "start" || $@ == "stop" || $@ == "restart" ]]; then
command pg_ctl -D /usr/local/var/postgres/default -l /usr/local/var/postgres/default/server.log $@
else
echo "Wrong pg command!"
fi
}
@danielglh
danielglh / git-merge-theirs
Created August 31, 2013 02:55
Simulate merge -s theirs since git has removed this strategy
#!/bin/sh
merge_branch=$1
test -z $merge_branch && echo "branch required." 1>&2 && exit 1
current_branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
git checkout $merge_branch
git checkout -b tmp
git merge -s ours $current_branch
#!/bin/bash
export STRIKINLY_PROMPT="\e[0;36m[Strikingly]\e[0;00m"
strikingly_say() {
printf "${STRIKINLY_PROMPT} $*\n"
}
strikingly_say "Start deploying strikingly developing environment"
if [ ! -d $HOME/.strikingly/ ]; then