Skip to content

Instantly share code, notes, and snippets.

@VincentSit
VincentSit / update_gfwlist.sh
Last active March 24, 2024 14:39
Automatically update the PAC for ShadowsocksX. Only tested on OS X. (Deprecated)
#!/bin/bash
# update_gfwlist.sh
# Author : VincentSit
# Copyright (c) http://xuexuefeng.com
#
# Example usage
#
# ./whatever-you-name-this.sh
#
# Task Scheduling (Optional)
@tqcenglish
tqcenglish / ChineseCharToEn.java
Last active January 15, 2021 12:07
Java汉字拼音首字母提取
package com.zycoo.android.sip.util;
import java.io.UnsupportedEncodingException;
/**
* 取得给定汉字串的首字母串,即声母串 Title: ChineseCharToEn
*
* {@link http://blog.csdn.net/fei1502816/article/details/8446049}
*
* @date 2004-02-19 注:只支持GB2312字符集中的汉字
@stormpython
stormpython / how_to_set_up_ssh_keys.md
Last active August 10, 2023 03:33
Setting up ssh keys for remote server access

How to Set up SSH Keys

Create the RSA Key Pair

ssh-keygen -t rsa

Store the Keys and Passphrase

Once you have entered the Gen Key command, you will get a few more questions:

@ranlix
ranlix / combineTS.py
Last active July 15, 2018 09:45
将同一目录下所有.ts文件合并到一个新的.ts文件(PS: .ts文件是可以直接合并的视频文件,因此可以这样合并)
# -*-coding: utf-8 -*-
import sys
import os
num = sys.argv[1] # num is the amount of *.ts files
def add(x):
"""'x' is the amount of *.ts
This function should add all other .ts combined into '1.ts'
@edokeh
edokeh / index.js
Last active July 23, 2024 14:08
佛祖保佑,永无 BUG
//
// _oo0oo_
// o8888888o
// 88" . "88
// (| -_- |)
// 0\ = /0
// ___/`---'\___
// .' \\| |// '.
// / \\||| : |||// \
// / _||||| -:- |||||- \
@joechrysler
joechrysler / who_is_my_mummy.sh
Last active May 14, 2024 12:26
Find the nearest parent branch of the current git branch
#!/usr/bin/env zsh
git show-branch -a \
| grep '\*' \
| grep -v `git rev-parse --abbrev-ref HEAD` \
| head -n1 \
| sed 's/.*\[\(.*\)\].*/\1/' \
| sed 's/[\^~].*//'
# How it works:
@hellojinjie
hellojinjie / 五种不同的 URL 参数解析方法的性能比较.md
Last active November 22, 2022 04:02
五种不同的 URL 参数解析方法的性能比较

五种不同的 URL 参数解析方法的性能比较

因为在我们的项目中需要解析日志中的 URL 的参数,所以我对比了一下五种不同 的 URL 参数解析方法的性能。

##URL 参数解析方法:

  1. httpclient org.apache.http.client.utils.URLEncodedUtils

@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 23, 2024 19:59
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active July 21, 2024 01:20
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh