Skip to content

Instantly share code, notes, and snippets.

@Hengjie
Hengjie / tutorial.md
Last active July 29, 2024 06:26
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
Hengjie / conmon.sh
Created June 9, 2019 23:51
Fixed working version of conpach
#!/bin/sh
. /lib/functions.sh
ROOTER=/usr/lib/rooter
ROOTER_LINK="/tmp/links"
log() {
logger -t "Connection Monitor" "$@"
}
@Hengjie
Hengjie / gist:7833364
Last active December 30, 2015 13:08
Get Google Chrome Extension's version
getVersion = ->
xhr = new XMLHttpRequest()
xhr.open "GET", chrome.extension.getURL("manifest.json"), false
xhr.send null
manifest = JSON.parse(xhr.responseText)
manifest.version
@Hengjie
Hengjie / example.haml.html
Created September 26, 2013 11:55
How to use Mailcheck.js with AngularJS https://github.com/Kicksend/mailcheck/
%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 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
Hengjie / gist:5729093
Created June 7, 2013 13:04
Linode DNS outage
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 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
else
worker_processes 4
end
timeout 30
@Hengjie
Hengjie / net_speed.sh
Created December 8, 2012 06:23
When ifstat tools don't work, this does
#!/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 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: 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",