$ man launchd
$ man launchctl
$ man launchd.plist
$ man plutil
| # prefixキーをC-tに変更する | |
| set -g prefix C-t | |
| # C-bのキーバインドを解除する | |
| unbind C-b | |
| # キーストロークのディレイを減らす | |
| set -sg escape-time 1 | |
| # ウィンドウのインデックスを1から始める |
| #!/bin/sh | |
| # usage: | |
| # ql /tmp/file.jpg | |
| # cat /tmp/file.jpg | ql | |
| # cal -h | ql | |
| if [ -z "$*" ]; then | |
| cat > /tmp/ql.stdin | |
| mime_type=$(file --brief --mime-type /tmp/ql.stdin) |
| #!/bin/bash | |
| # Check if curl is installed | |
| if ! [ -x "$(command -v curl)" ]; then | |
| echo "Error: curl is not installed. Please install curl and try again." >&2 | |
| exit 1 | |
| fi | |
| # Check if jq is installed | |
| if ! [ -x "$(command -v jq)" ]; then |
| curl -H "Accept: application/vnd.github.v3.star+json" https://api.github.com/users/glaforge/starred |
| # Recently I had to send a password to someone over Skype. Since that's obviously not a good idea, I asked for | |
| # the person's public SSH RSA key, and used it to encrypt the password itself. | |
| # Convert the public key into PEM format | |
| ssh-keygen -f path/to/id_rsa.pub -e -m pem > ~/id_rsa.pub.pem | |
| # Using the public pem file to encrypt a string | |
| echo "sometext" | openssl rsautl -encrypt -pubin -inkey ~/id_rsa.pub.pem > ~/encrypted.txt |
| # E.g. to restore Python's virtualenv | |
| function shell_session_save_user_state() { | |
| echo "function restore_session() {" >> ${SHELL_SESSION_FILE} | |
| if [[ -n ${VIRTUAL_ENV} ]]; then | |
| echo source \"${VIRTUAL_ENV}\"/bin/activate >> ${SHELL_SESSION_FILE} | |
| fi | |
| echo "}" >> $SHELL_SESSION_FILE |
| # National Anthem of USSR | |
| # Execute this ShellScript, Soviet Anthem Plays You. | |
| # Before execute this, you have to install Sox(Sound eXchange) by apt-get / brew. | |
| mkdir notes | |
| cat << EOS | grep -v "-" | awk '{if ($1=="z") {print "sox -n -c 2 notes/"NR".wav trim 0.0", $2/4} else {{print "sox -n -c 2 notes/" NR ".wav synth", $2/4, "pluck", $1, "\\"} if ($3!="") {print "pluck", $3, "\\"} if ($5!="") {print "pluck", $5, "\\"} print ";"}}END{print "sox notes/{1.."NR-1"}.wav song_new.wav"}' | bash | |
| E4 4 G4 4 C5 4 | |
| - | |
| D4 1 G4 1 D5 1 | |
| C4 1 G4 1 C5 1 |