Skip to content

Instantly share code, notes, and snippets.


Jian Li kidlj

View GitHub Profile
devtdeng / verify_certificate.go
Last active Nov 10, 2021
Verify a certificate with chain with golang crypto library
View verify_certificate.go
package main
import (
Phlow / pagination-collection.liquid
Last active May 3, 2021
If you need pagination for a collection in a Jekyll theme, you can use the following Liquid logic which works also on Github pages
View pagination-collection.liquid
{% comment %}
# I modified the original code from
# Make a collection in _config.yml and create the folder _your_collection in your root.
# collections:
# your_collection:
# output: true
# permalink: /:collection/:title/
tonysneed / Mac OS X: Open in Visual Studio Code
Last active Dec 14, 2021
Add a command to Finder services in Mac OSX to open a folder in VS Code
View Mac OS X: Open in Visual Studio Code
- Open Automator
- File -> New -> Service
- Change "Service Receives" to "files or folders" in "Finder"
- Add a "Run Shell Script" action
- Change "Pass input" to "as arguments"
- Paste the following in the shell script box: open -n -b "" --args "$*"
- Save it as something like "Open in Visual Studio Code"
Phlow / jekyll-sorted-category-for-loop-alphabetical-date.liquid
Last active Jun 11, 2021
Jekyll (Liquid) for loop to sort posts by category in alphabetical or date-based or similiar order.
View jekyll-sorted-category-for-loop-alphabetical-date.liquid
{% comment %}
# Change date order by adding '| reversed'
# To sort by title or other variables use {% assign sorted_posts = category[1] | sort: 'title' %}
{% endcomment %}
{% assign sorted_cats = site.categories | sort %}
{% for category in sorted_cats %}
{% assign sorted_posts = category[1] | reverse %}
<h2 id="{{category[0] | uri_escape | downcase }}">{{category[0] | capitalize}}</H2>
nooop3 / shadowsocks-client.service
Created Oct 28, 2015
Shadsocks client service for CentOS 7. Touch file /etc/shadowsocks/config.json, and copy this to /etc/systemd/system/shadowsocks-client.service. After of all, type systemctl start shadowsocks-client and systemctl enable shadowsocks-client to add it to startup.
View shadowsocks-client.service
Description=Shadowsocks Client
ExecStartPre=/bin/mkdir -p /run/shadowsocks
ExecStartPre=/bin/chown root:root /run/shadowsocks
denji /
Last active Jan 27, 2022 — forked from spikebike/client.go
Simple Golang HTTPS/TLS Examples

Moved to git repository:

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
ethagnawl / .inputrc
Last active May 5, 2021
Display Vim mode in Bash prompt
View .inputrc
# requires >= Bash 4.3
# note: the prompt will not be updated if you use a custom PS1 which contains a newline character
set editing-mode vi
set keymap vi-command
set show-mode-in-prompt on
# if it's configured correctly, your prompt will be prefixed with a `+` while in insert mode and a `:` when in command mode.
mobilemind /
Last active Jan 21, 2022
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
jedschneider /
Created Jun 7, 2012
github pages tips for jekyll wiki

Working With Github Pages

The FAQ maintained by Github covers most stumbling blocks, some other tips and tricks supplied here.


Add _site to .gitignore. The generated site should not be uploaded to Github since its gets generated by github.

Working With Code Partials

icyleaf /
Created Sep 6, 2010
git autodeploy script when it matches the string "[deploy]"
# git autodeploy script when it matches the string "[deploy]"
# @author icyleaf <>
# @link
# @version 0.1
# Usage:
# 1. put this into the post-receive hook file itself below