Skip to content

Instantly share code, notes, and snippets.

View czyang's full-sized avatar
🏠
Working from home

Chengzhi Yang czyang

🏠
Working from home
View GitHub Profile
@czyang
czyang / README.md
Created February 10, 2017 11:05 — forked from renchap/README.md
One-line certificate generation/renews with Letsencrypt and nginx

Prerequisites : the letsencrypt CLI tool

This method allows your to generate and renew your Lets Encrypt certificates with 1 command. This is easily automatable to renew each 60 days, as advised.

You need nginx to answer on port 80 on all the domains you want a certificate for. Then you need to serve the challenge used by letsencrypt on /.well-known/acme-challenge. Then we invoke the letsencrypt command, telling the tool to write the challenge files in the directory we used as a root in the nginx configuration.

I redirect all HTTP requests on HTTPS, so my nginx config looks like :

server {
@czyang
czyang / downloads.js
Created November 11, 2016 10:11 — forked from xd547/downloads.js
ASUS DownloadMaster batch downloads
// 1. open DownloadMaster in chrome
// 2. use the code in chrome console
urls = ["", ""] //urls array
addDownload = function(url) {
showPanel();
document.getElementById("HTTP_usb_dm_url").value = url;
dm_add_status();
}
@czyang
czyang / ss-install.md
Last active May 22, 2016 08:21 — forked from aa65535/ss-install.md
shadowsocks-libev install at Debian or CentOS

Debian

cd /tmp
# 下载源码
git clone https://github.com/shadowsocks/shadowsocks-libev.git
# 开始编译
cd shadowsocks-libev
./autogen.sh
./configure --prefix=/usr && make
make install
@czyang
czyang / gist:c2672eed208a7b0b99c9
Last active August 29, 2015 14:08
This bash script use ImageMagick trim the transparent part of the images in a directory.
#!/bin/bash
# This script need ImageMagick
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
for file in *.png
do
echo "trim: $file"
convert $file -trim $file
done
// Photoshop Script to Create iPhone Icons from iTunesArtwork
//
// WARNING!!! In the rare case that there are name collisions, this script will
// overwrite (delete perminently) files in the same folder in which the selected
// iTunesArtwork file is located. Therefore, to be safe, before running the
// script, it's best to make sure the selected iTuensArtwork file is the only
// file in its containing folder.
//
// Copyright (c) 2010 Matt Di Pasquale
// Added tweaks Copyright (c) 2012 by Josh Jones http://www.appsbynight.com