Skip to content

Instantly share code, notes, and snippets.

View marschhuynh's full-sized avatar
🎯
Focusing

Marsch Huynh marschhuynh

🎯
Focusing
View GitHub Profile
@marschhuynh
marschhuynh / ModuleExport vs Export.md
Last active September 2, 2016 05:49
Different between Module.exports and exports in Nodejs

Module is a plain JavaScript object with an exports property. exports is a plain JavaScript variable that happens to be set to module.exports. At the end of your file, node.js will basically 'return' module.exports to the require function. A simplified way to view a JS file in Node could be this:

var module = { exports: {} };
var exports = module.exports;

// your code

return module.exports;
@marschhuynh
marschhuynh / temp.sh
Created August 30, 2016 04:59
Temperature on Raspberry
#!/bin/bash
cpuTemp0=$(cat /sys/class/thermal/thermal_zone0/temp)
cpuTemp1=$(($cpuTemp0/1000))
cpuTemp2=$(($cpuTemp0/100))
cpuTempM=$(($cpuTemp2 % $cpuTemp1))
echo CPU temp"="$cpuTemp1"."$cpuTempM"'C"
echo GPU $(/opt/vc/bin/vcgencmd measure_temp)
@marschhuynh
marschhuynh / Sublime setting.md
Last active September 2, 2016 08:10
My sublime setting
{
	"color_scheme": "Packages/Boxy Theme/schemes/Boxy Ocean.tmTheme",
	"ignored_packages":
	[
		"Vintage"
	],
	"itg_sidebar_tree_medium": true,
	"itg_small_tabs": true,
	"preview_on_click": true,
@marschhuynh
marschhuynh / stylesheet.css
Created September 7, 2016 16:21
My Atom stylesheet
/*
* Your Stylesheet
*
* This stylesheet is loaded when Atom starts up and is reloaded automatically
* when it is changed and saved.
*
* Add your own CSS or Less to fully customize Atom.
* If you are unfamiliar with Less, you can read more about it here:
* http://lesscss.org
*/
@marschhuynh
marschhuynh / fixhipchat
Created October 19, 2016 03:12
Fix fcitx for hipchat
sudo ln -s /usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.so /opt/HipChat/lib/plugins/platforminputcontexts
http://macnhack.blogspot.com/2015/10/huong-dan-patch-applehda-cho-cac-laptop.html
.sm-title {
font-size: 16px;
padding: 0px 25px 0px 0px;
}
.sm-label {
color: #bbb;
font-size: 12px;
}
@marschhuynh
marschhuynh / mongo-autostart-osx.md
Created December 20, 2016 16:44 — forked from subfuzion/mongo-autostart-osx.md
mongo auto start on OS X

Install with Homebrew

brew install mongodb

Set up launchctl to auto start mongod

$ ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents

/usr/local/opt/mongodb/ is a symlink to /usr/local/Cellar/mongodb/x.y.z (e.g., 2.4.9)

@marschhuynh
marschhuynh / proxy.sh
Last active March 15, 2020 09:55
Sock proxy
#! /bin/sh
SERVER=gg-sing
HOST=localhost
PORT=8123
SOCK_ID=$(date +%s)
ssh -CNM -f -q -D 8123 -S /tmp/proxy-${SOCK_ID}.sock ${SERVER}
sudo networksetup -setsocksfirewallproxy "Wi-Fi" localhost 8123
@marschhuynh
marschhuynh / gist:71db5ed80eef45996624093047f20be9
Created December 30, 2016 17:53
Run command line as another user
su - root -c "command"
OR
su - -c "command arg1"