Skip to content

Instantly share code, notes, and snippets.

Hengjie Hengjie

Block or report user

Report or block Hengjie

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Hengjie
Hengjie / conmon.sh
Created Jun 9, 2019
Fixed working version of conpach
View conmon.sh
#!/bin/sh
. /lib/functions.sh
ROOTER=/usr/lib/rooter
ROOTER_LINK="/tmp/links"
log() {
logger -t "Connection Monitor" "$@"
}
@Hengjie
Hengjie / tutorial.md
Last active Jun 20, 2019
How to passthrough SATA drives directly on VMWare ESXI 6.5 as RDMs
View tutorial.md

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
Hengjie / gist:7833364
Last active Dec 30, 2015
Get Google Chrome Extension's version
View gist:7833364
getVersion = ->
xhr = new XMLHttpRequest()
xhr.open "GET", chrome.extension.getURL("manifest.json"), false
xhr.send null
manifest = JSON.parse(xhr.responseText)
manifest.version
View example.haml.html
%input{:name => "email", :type => "email", :"ng-model" => "email"}(mailcheck)/
%small.ng-cloak.mailcheck{:"ng-show" => "mailcheck.suggested"}
Did you mean
%a{:"ng-click" => "mailcheck.select()", :href => "#"}
%span.address> {{mailcheck.suggestion.address}}
@
%span.domain> {{mailcheck.suggestion.domain}}
?
@Hengjie
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
Hengjie / gist:5729093
Created Jun 7, 2013
Linode DNS outage
View gist:5729093
My startup site's DNS Notable.ac 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 8.8.8.8
Default server: 8.8.8.8
Address: 8.8.8.8#53
@Hengjie
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
else
worker_processes 4
end
timeout 30
@Hengjie
Hengjie / net_speed.sh
Created Dec 8, 2012
When ifstat tools don't work, this does
View net_speed.sh
#!/bin/bash
# This shell script shows the network speed, both received and transmitted.
# http://www.adminsehow.com/2010/03/shell-script-to-show-network-speed/
# Usage: net_speed.sh interface
# e.g: net_speed.sh eth0
# Global variables
interface=$1
interface=eth0
@Hengjie
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: http://rubenlaguna.com/wp/2012/02/01/sublime-text-2-rvm-rspec/index.html#comment-605225107
{
"env": {
"PATH": "${HOME}/.rvm/bin:${PATH}"
},
"cmd": ["rvm-auto-ruby", "$file"],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.ruby",
You can’t perform that action at this time.