Skip to content

Instantly share code, notes, and snippets.

Avatar
🐈
Cataholic

Ash Wu hSATAC

🐈
Cataholic
View GitHub Profile
@hSATAC
hSATAC / gist:99bf00ea75443d3b4a15
Created Sep 21, 2015
Fix unable to mount boot
View gist:99bf00ea75443d3b4a15
# Boot from USB...
mkdir /mnt/arch
cd /mnt/arch
mount -t proc proc proc/
mount -t sysfs sys sys/
mount -o bind /dev dev/
chroot . /bin/bash
mount -a
pacman -S linux
@hSATAC
hSATAC / reviewer.sh
Last active Aug 19, 2019
Jenkins postbuild script assign github reviewer
View reviewer.sh
#!/bin/bash
rand() {
echo $(( $1 * RANDOM / 32768 ))
}
rand_element () {
local -a th=("$@")
echo "${th[$( rand ${#th[@]} )]}"
}
reviewers=(hSATAC poga aar0nTw hanklin kerkerj)
View rand_element.sh
#!/bin/bash
rand() {
echo $(( $1 * RANDOM / 32768 ))
}
rand_element () {
local -a th=("$@")
echo "${th[$( rand ${#th[@]} )]}"
}
@hSATAC
hSATAC / .gitignore
Last active Aug 29, 2015 — forked from monde/.gitignore
Micro Gem to get an OAuth token and secret for the Tumblr.com API allowing an external application to post Tumblr.com blog.
View .gitignore
Gemfile.lock
@hSATAC
hSATAC / boot2docker-nfs.rb
Last active Sep 24, 2015 — forked from mattes/boot2docker-nfs.rb
docker-machine/ boot2docker with NFS instead of vboxsf
View boot2docker-nfs.rb
#!/usr/bin/env ruby
# Usage
# $ docker-machine create my-machine123 -d virtualbox
# $ ruby <(curl -L https://git.io/vZT32) my-machine123
# https://gist.github.com/hSATAC/ac91f6cdc88c5a12ed5a
require 'erb'
bootlocalsh = %Q(#/bin/bash
View uniqush-push
#!/bin/sh
### BEGIN INIT INFO
# Provides: uniqush-push
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts uniqush-push
# Description: Starts Uniqush provides a unified push service for server-side notification to apps on mobile devices.
### END INIT INFO
View profilingtool.go
package main
import (
"fmt"
"log"
"os"
"runtime"
"runtime/debug"
"runtime/pprof"
"strconv"
@hSATAC
hSATAC / new_gist_file_0
Created Dec 2, 2014
Install OSX vm in OSX
View new_gist_file_0
記錄一下步驟
1. 從 appstore 下載 OSX 安裝檔,不需要安裝
2. gem install iesd
3. iesd -i /Applications/Install\ OS\ X\ Mavericks.app -o Mavericks.dmg -t BaseSystem 做完會在家目錄多一個 Mavericks.dmg
4. 開一個 VirtualBox 虛擬機器,選 OSX Mavericks 建立好以後先不要開機,進入設定 > 系統 > 晶片組選 PIIX3 然後確定 EFI 有打勾
View benchmark+go+nginx.md

Benchmarking Nginx with Go

There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.

So, these are the different settings we are going to compare:

  • Go HTTP standalone (as the control group)
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI
View slackpost.sh
#!/bin/bash
# Usage: slackpost <username> <channel> <message>
# Enter the name of your slack host here - the thing that appears in your URL:
# https://slackhost.slack.com/
slackhost=HOST_HERE
token=TOKEN_HERE
userName=$1