Skip to content

Instantly share code, notes, and snippets.

suntong /
Last active Jul 17, 2019 — forked from goldie-lin/git-bash.awk re-implemented with gawk. >100x faster under git-win (requires git version >= 2.11.0)
#!/usr/bin/env bash
git rev-parse 2>/dev/null && \
git status --porcelain=v2 -b --ignored | gawk '
/^# branch\.head / { head = $0; sub(/# branch\.head /, "", head); next; }
/^# branch\.ab / { match($0, /^# branch\.ab \+([0-9]+) -([0-9]+)$/, ab); ahead = ab[1]; behind = ab[2]; next; }
/^! / { next; } /* ignored */
/^[12] [^.]. / { staged++; next; }
/^[12] \.[MD] / { changed++; next; }
suntong / http.go
Created Jun 7, 2019 — forked from AngerM/http.go
High Performance Golang HTTP Client
View http.go
package utils
import (
View foo.go
// Program: dbab-svr
// Purpose: Pixel Server in Go
// Authors: Tong Sun (c) 2019, All rights reserved
package main
import (
suntong / simplest.js
Last active Feb 11, 2018 — forked from anonymous/simplest.js
gopherjs bare bone js code base
View simplest.js
"use strict";
(function() {
Error.stackTraceLimit = Infinity;
var $global, $module;
if (typeof window !== "undefined") { /* web page */
$global = window;
} else if (typeof self !== "undefined") { /* web worker */
$global = self;
suntong / 0_reuse_code.js
Created Jan 18, 2017
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
suntong / udp-port-scanning.txt
Created Jul 9, 2016 — forked from benhosmer/udp-port-scanning.txt
UDP Port Troubleshooting using netcat
View udp-port-scanning.txt
Using the nc command you can scan a port or a range of ports to verify whether a UDP port is open and able to receive traffic.
This first command will scan all of the UDP ports from 1 to 65535 and add the results to a text file:
$ nc -vnzu 1-65535 > udp-scan-results.txt
This merely tells you that the UDP ports are open and receive traffic.
Perhaps a more revealing test would be to actually transfer a file using UDP.
#List unique values in a DataFrame column
#Convert Series datatype to numeric, getting rid of any non-numeric values
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True)
#Grab DataFrame rows where column has certain values
valuelist = ['value1', 'value2', 'value3']
df = df[df.column.isin(value_list)]
suntong /
Last active Dec 18, 2015 — forked from huyng/matplotlibrc
my default matplotlib settings


This is a custom config based on huyng's gist: which implements a nicer color scheme for matplotlib, along with some other styling tweaks.

Problem statement (Aka Goal)

  • The gist was created on Feb 8, 2011. That's old and things have changed
  • Focus on the color scheme tweaking for matplotlib, for the rest use the latest default as much as possible
  • Incorporate all good changes from the following forks:
View main.go
package main
import (
You can’t perform that action at this time.