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 | |
# List latest china IPv4 list | |
require 'open-uri' | |
(ARGF.path == '-' ? open('http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest') : ARGF).lines.each do |l| | |
next if !l.include?('ipv4') || l.include?('*') | |
cc, type, start, value = l.split('|')[1, 4] |
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: |
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/python3 | |
import json | |
import os | |
import re | |
import shlex | |
import subprocess | |
import sys | |
import time |
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
public class Hello { | |
public static void main(String args[]) { | |
System.out.println("hello world"); | |
} | |
} |
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" |
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
// compile with -std=c++1y | |
#include <algorithm> | |
#include <functional> | |
#include <iterator> | |
#include <vector> | |
namespace LoDash { | |
using std::begin; |
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 |
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
// Link with -rdynamic | |
#include <execinfo.h> | |
#include <assert.h> | |
#include <stdio.h> | |
#include <assert.h> | |
#include <stdlib.h> | |
void bt() { | |
const size_t size = 100; |
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: |
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 | |
require 'digest' | |
hosts = ARGV.to_a | |
hosts = $<.each_line.map(&:chomp) if hosts.empty? | |
hosts.uniq! | |
def system! *args | |
raise "Cannot exec #{args}" unless system(*args.flatten) |
NewerOlder