Skip to content

Instantly share code, notes, and snippets.

View scbizu's full-sized avatar
🤗
用代码给大家带来笑容 Bring smiles with codes

Nace Sc scbizu

🤗
用代码给大家带来笑容 Bring smiles with codes
View GitHub Profile
@fatih
fatih / switchgo.sh
Last active December 31, 2019 13:58
Switch between go version using https://github.com/golang/dl
function switchgo() {
version=$1
if [ -z $version ]; then
echo "Usage: switchgo [version]"
return
fi
if ! command -v "go$version" > /dev/null 2>&1; then
echo "version does not exist, download with: "
echo " go get golang.org/dl/go${version}"
@fnky
fnky / ANSI.md
Last active May 3, 2024 00:12
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@danielv99
danielv99 / l2tpclient.sh
Last active April 4, 2024 20:30
L2TP VPN client on Linux Debian
# Requirements
# debian/ubuntu
apt-get -y update && apt-get -y upgrade
apt-get -y install strongswan xl2tpd libstrongswan-standard-plugins libstrongswan-extra-plugins
VPN_SERVER_IP=''
VPN_IPSEC_PSK='y'
VPN_USER=''
VPN_PASSWORD=''
@roylee0704
roylee0704 / dockergrep.sh
Created December 9, 2016 08:24
how to grep docker log
docker logs nginx 2>&1 | grep "127."
# ref: http://stackoverflow.com/questions/34724980/finding-a-string-in-docker-logs-of-container
@sosedoff
sosedoff / 1_simple.go
Created July 16, 2016 18:45
Golang Custom Struct Tags Example
package main
import (
"fmt"
"reflect"
)
// Name of the struct tag used in examples
const tagName = "validate"
@mfuerstenau
mfuerstenau / zigzag-encoding.README
Last active February 22, 2024 03:40
ZigZag encoding/decoding explained
ZigZag-Encoding
---------------
Maps negative values to positive values while going back and
forth (0 = 0, -1 = 1, 1 = 2, -2 = 3, 2 = 4, -3 = 5, 3 = 6 ...)
(i >> bitlength-1) ^ (i << 1)
with "i" being the number to be encoded, "^" being
XOR-operation and ">>" would be arithemtic shifting-operation
@grafikchaos
grafikchaos / Cherry Picking Multiple Commits.md
Last active October 9, 2023 17:30
Cherry pick multiple commits from a remote or upstream branch
@bnerd
bnerd / ffmpeg
Created November 13, 2012 23:18
Encode RTMP input stream into multiple outputs with ffmpeg
ffmpeg -re -i rtmp://localhost/live/input_stream -acodec libfaac -ab 128k -vcodec libx264 -s 640x360 -b:v 500k -preset medium -vprofile baseline -r 25 -f flv rtmp://localhost/live/medium_500k -acodec libfaac -ab 128k -vcodec libx264 -s 480x272 -b:v 300k -preset medium -vprofile baseline -r 25 -f flv rtmp://localhost/live/medium_300k -acodec libfaac -ab 128k -c:v libx264 -s 320x200 -b:v 150k -preset:v fast -profile:v baseline -level 1.2 -r 25 -f flv rtmp://localhost/live/medium_150k -acodec libfaac -vn -ab 48k -f flv rtmp://localhost/live/audio_only
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 1, 2024 03:34
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a