Skip to content

Instantly share code, notes, and snippets.

View agate's full-sized avatar
🏠
Working from home @ Shanghai

Hao Hong agate

🏠
Working from home @ Shanghai
View GitHub Profile
@agate
agate / script.sh
Last active December 16, 2015 22:20
DIR is the real directory of this script
SOURCE="${BASH_SOURCE[0]}"
# resolve $SOURCE until the file is no longer a symlink
while [ -h "$SOURCE" ]; do
TARGET="$(readlink "$SOURCE")"
if [[ $SOURCE == /* ]]; then
SOURCE="$TARGET"
else
DIR="$( dirname "$SOURCE" )"
# if $SOURCE was a relative symlink, we need to resolve it relative
# to the path where the symlink file was located
@agate
agate / md_readbit.rb
Created September 10, 2013 09:12
Ruby Modbus Test
#!/usr/bin/env ruby
require 'rmodbus'
# PORT = '/dev/ttyACM0'
PORT = '/dev/tty.usbmodemfd1221'
def bytes2holdings(bytes)
bytes.each_slice(2).map { |arr| arr[0] * 256 + arr[1].to_i }
end
@agate
agate / performance_test.rb
Created December 12, 2013 03:06
Curl / Curl with multi / Curl with parallel gem
require 'parallel'
require 'curb'
TEST_URL = 'http://www.baidu.com'
def normal
responses = []
100.times do
easy = Curl::Easy.new(TEST_URL)
easy.perform
@agate
agate / zixuan.html
Last active August 29, 2015 14:05 — forked from mavericklou/zixuan.html
<!DOCTYPE html>
<html>
<head>
<title>Stocks</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<style type="text/css" media="screen">
.stock {
min-height: 273px;
padding: 0;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
// ==UserScript==
// @name 4clojure navigate buttons
// @namespace http://agate.github.com
// @version 0.1
// @description add a prev / next button for problem page
// @author agate
// @match https://www.4clojure.com/problem/*
// @match http://www.4clojure.com/problem/*
// @grant none
// ==/UserScript==
@agate
agate / 4clojure-answers.md
Last active November 3, 2015 03:48 — forked from SegFaultAX/gist:3607101
4Clojure Answers
@agate
agate / README.md
Created November 23, 2015 12:12 — forked from janlay/README.md
Yet another config for Surge.app

Install

  1. Modify index.txt with your output path and proxy info
  2. Use Text Builder to build configuration for Surge: $ text-builder -index /path/to/index.txt
  3. Import configuration via AirDrop/iTunes/Dropbox/iCloud
// ==UserScript==
// @name Github Issue Branch Name
// @namespace http://agate.github.com
// @version 0.1
// @description Auto generate feature branch with issue's title
// @author agate
// @match https://github.com/*/*/issues/*
// @grant none
// ==/UserScript==
@agate
agate / drawer.html
Last active December 22, 2015 10:16
<!DOCTYPE html>
<html ng-app="Drawer">
<head>
<meta charset="utf-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Drawer</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<style media="screen">