Skip to content

Instantly share code, notes, and snippets.

Hengjie /
Created Jun 9, 2019
Fixed working version of conpach
. /lib/
log() {
logger -t "Connection Monitor" "$@"
Hengjie /
Last active Sep 5, 2022
How to passthrough SATA drives directly on VMWare ESXI 6.5 as RDMs

How to passthrough SATA drives directly on VMWare EXSI 6.5 as RDMs

There aren't many tutorials about this, the only tutorials I've found were about passing through entire PCIe cards to VMs, or refered to old ESXI versions (below 6.5) that used a more comprehensive desktop client instead of the web app. In v6.5, the web app was introduced and the desktop client was deprecated. You used to be able to setup RDMs in the desktop client, but with the introduction of the web console, this is no longer the case. This tutorial shows you how to pass SATA HDDs to the virtual machine on VMWare ESXI 6.5. This tutorial is partially based on VMWare's own KB and the now deprecated Forza IT blog post.

A word about VMWare ESXI 6.7

There is now an option while editing your VM's settings to add a New raw disk when you click `Add ha

Hengjie / gist:7833364
Last active Dec 30, 2015
Get Google Chrome Extension's version
View gist:7833364
getVersion = ->
xhr = new XMLHttpRequest() "GET", chrome.extension.getURL("manifest.json"), false
xhr.send null
manifest = JSON.parse(xhr.responseText)
View example.haml.html
%input{:name => "email", :type => "email", :"ng-model" => "email"}(mailcheck)/{:"ng-show" => "mailcheck.suggested"}
Did you mean
%a{:"ng-click" => "", :href => "#"}
%span.address> {{mailcheck.suggestion.address}}
%span.domain> {{mailcheck.suggestion.domain}}
Hengjie / gist:6016646
Created Jul 17, 2013
Modernizr orientationchange test in CoffeeScript
View gist:6016646
# Chrome Android tends to fire 'resize' events on scroll
# This detects it to run certain code using $(window).bind 'orientationchange'
# instead of $(window).resize
Modernizr.addTest 'orientationchange', ->
return !!(window.orientation? and Modernizr.touch)
Hengjie / gist:5729093
Created Jun 7, 2013
Linode DNS outage
View gist:5729093
My startup site's DNS is hosted on Linode.
It appears the DNS server from both Level 3 and Google can't resolve Notable's domain name but if I ask nslook to query Linode's DNS servers, it responds correctly.
Either Linode's DNS is down or it can't contact Google/L3s'.
$ nslookup
> server
Default server:
Hengjie / gist:4633113
Created Jan 25, 2013
Minimize Unicorn worker_processes in 'development' env
View gist:4633113
environment = ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'production'
# Save on RAM while in development
if environment == 'development'
worker_processes 1
worker_processes 4
timeout 30
Hengjie /
Created Dec 8, 2012
When ifstat tools don't work, this does
# This shell script shows the network speed, both received and transmitted.
# Usage: interface
# e.g: eth0
# Global variables
Hengjie / Ruby.sublime-build
Created Dec 6, 2012
Sublime Text 2 with RVM
View Ruby.sublime-build
// Sublime Text 2 (on Mac OSX) with RVM
// This file: /Users/YOUR_USERNAME/Library/Application Support/Sublime Text 2/Packages/Ruby/Ruby.sublime-build
// Thanks to:
"env": {
"PATH": "${HOME}/.rvm/bin:${PATH}"
"cmd": ["rvm-auto-ruby", "$file"],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.ruby",