Skip to content

Instantly share code, notes, and snippets.

View SanCoder-Q's full-sized avatar
💭
I may be slow to respond.

JmQu SanCoder-Q

💭
I may be slow to respond.
View GitHub Profile
@SanCoder-Q
SanCoder-Q / file
Created November 13, 2017 16:00 — forked from liantian-cn/file
shadowsocks iptables规则
# 新建一个无密码,无法登陆,没home的系统用户,就叫shadowsocks
adduser --system --disabled-password --disabled-login --no-create-home shadowsocks
# 修改 /etc/default/shadowsocks-libev
USER=shadowsocks
GROUP=nogroup
# 使用setcap,允许非root用户无法监听低位端口
apt-get install libcap2-bin
setcap 'cap_net_bind_service=+ep' /usr/bin/ss-server
@SanCoder-Q
SanCoder-Q / gpg-import-and-export-instructions.md
Created September 18, 2017 10:05 — forked from chrisroos/gpg-import-and-export-instructions.md
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

@SanCoder-Q
SanCoder-Q / !react-enzyme-render-methods.md
Created February 8, 2017 03:37 — forked from richardscarrott/!react-enzyme-render-methods.md
react-enzyme - `shallow` vs `mount` vs `render` lifecycle methods

An exploration of the different render methods available in react-enzyme.

@SanCoder-Q
SanCoder-Q / Future-retry.scala
Created November 12, 2016 05:54 — forked from viktorklang/Future-retry.scala
Asynchronous retry for Future in Scala
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext
import scala.concurrent.Future
import akka.pattern.after
import akka.actor.Scheduler
/**
* Given an operation that produces a T, returns a Future containing the result of T, unless an exception is thrown,
* in which case the operation will be retried after _delay_ time, if there are more possible retries, which is configured through
* the _retries_ parameter. If the operation does not succeed and there is no retries left, the resulting Future will contain the last failure.
@SanCoder-Q
SanCoder-Q / unload-keyboard
Last active July 25, 2016 07:24 — forked from JohnMurray/unload-keyboard
Disable Mac OS X Keyboard (built-in only)
#!/bin/bash
# Unload the keyboard so I can use my external keyboard
# and not worry about accidentally pressing buttons on
# the built-in. This may not be a problem for you but, you
# should see my desk sometimes (Oh no!!) ;-)
sudo kextunload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext/
# enableIt
function git-revert-batch {
echo "$@" | xargs -n1 git revert --no-commit
}
alias grb='git-revert-batch'
# use like:
# grb ee5c95a 981da8b
# list commits in reverse order, and it's ready to make one neat+tidy revert-commit