View Cargo.toml
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
[package] | |
name = "pathmatcher" | |
version = "0.1.0" | |
edition = "2018" | |
[lib] | |
path = "lib.rs" | |
[dependencies] | |
bitflags = "1.0" |
View sftp-changes.py
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
#!/usr/bin/env python | |
"""A naive incremental sync script via sftp | |
When do you want to use this? | |
- want a non-lazy local file system (not fuse/sshfs) | |
- sftp is configured easier to use than ssh (rsync or git) | |
This script is very simple and does not handle complex cases. Use rsync to: | |
- set up an initial mirror |
View Gemfile
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
source 'http://rubygems.org' | |
gem 'i3ipc', '~> 0.2.0' |
View prefork-echo-server.py
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
#! /usr/bin/env python3 | |
# quick & dirty preforked echo server listening on /tmp/server | |
# client: socat unix-connect:/tmp/server stdout | |
import os, sys, time, socketserver | |
class PreforkMixIn: | |
max_nchildren = 3 | |
children = None |
View git-vendor.sh
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
fatal() { | |
echo "$@" | |
exit 1 | |
} | |
get_vendor_dir() { | |
[ -n "$VENDOR" ] && echo $VENDOR && return | |
[ -d src ] && echo src/vendor && return | |
echo vendor | |
} |
View qingcloud-control.rb
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
#!/usr/bin/env ruby | |
# qingcloud-control | |
# | |
# Poor man's qingcloud single instance management script. You may find this script useful, if you: | |
# - are an individual qingcloud user. do not have a lot of instances (assuming only one) | |
# - do not need to run instance 7x24. instances are powered off most of the time | |
# - do not use advanced networks. no routers, no private networks. just an instance with default network and an eip attached | |
# - want to save money | |
# - use ssh to login, have following lines in ~/.ssh/config: |
View copy-paste.sh
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
copy () { | |
cat "$@" 2> /dev/null | xsel -b | |
local _path | |
for _path in "$@" | |
do | |
if [ "${_path[1]}" = '/' ] | |
then | |
echo "${_path}" | |
else | |
echo "${PWD}/${_path}" |
View gdb-trace.py
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
#!/usr/bin/env python | |
try: | |
import gdb | |
inside_gdb = True | |
except ImportError: | |
inside_gdb = False | |
if inside_gdb: |
View git-pushf
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
#!/usr/bin/env ruby | |
# Find git root | |
while !File.exists?('.git/config') | |
Dir.chdir('..') | |
raise 'git root not found' if Dir.pwd == '/' | |
end | |
args = ARGV |
View create_machine.sh
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/sh | |
### functions | |
f() { echo "Failed."; exit; } | |
check_packages() | |
{ | |
hash linux || apt-get install user-mode-linux || f | |
hash debootstrap || apt-get install debootstrap || f |
NewerOlder