An exploration of the different render methods available in react-enzyme.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
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.
cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 新建一个无密码,无法登陆,没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 |