Skip to content

Instantly share code, notes, and snippets.

Hengjie /
Created June 9, 2019 23:51
Fixed working version of conpach
. /lib/
log() {
logger -t "Connection Monitor" "$@"
Hengjie /
Last active May 1, 2024 02:33
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 December 30, 2015 13:08
Get Google Chrome Extension's version
getVersion = ->
xhr = new XMLHttpRequest() "GET", chrome.extension.getURL("manifest.json"), false
xhr.send null
manifest = JSON.parse(xhr.responseText)
Hengjie / example.haml.html
Created September 26, 2013 11:55
How to use Mailcheck.js with AngularJS
%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 July 17, 2013 00:41
Modernizr orientationchange test in CoffeeScript
# 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 June 7, 2013 13:04
Linode DNS outage
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 January 25, 2013 09:36
Minimize Unicorn worker_processes in 'development' env
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 December 8, 2012 06:23
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 December 6, 2012 21:36
Sublime Text 2 with RVM
// 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",