Skip to content

Instantly share code, notes, and snippets.

@hyharryhuang
hyharryhuang / startPython.sh
Last active August 29, 2015 14:12
Easy Kill and Rerun Python Wrapper
STARTSCRIPT="run.py"
echo "Running script..."
sudo pkill -f $STARTSCRIPT
sudo python $STARTSCRIPT &
@hyharryhuang
hyharryhuang / ScriptTagAvoidProblems.htm
Created January 1, 2015 17:19
Avoiding problems with embedded < in scripts
<script type="text/javascript">
//<![CDATA[
//]]>
</script>
@hyharryhuang
hyharryhuang / IterateExample.js
Created January 12, 2015 18:32
Iterate through javascript Objects
for (var key in p) {
if (p.hasOwnProperty(key)) { //make sure key is part of this object, not coming from a prototype.
alert(key + " -> " + p[key]);
}
}
@hyharryhuang
hyharryhuang / mapFilterReduce.js
Created January 22, 2015 10:45
Javascript Map, Filter, Reduce Usage
var a = [1,2,3,4,5];
//MAP
var mapped = a.map(function(number) {
return number * 2;
});
console.log(mapped);
//FILTER
#!/bin/sh
#Runs from the existing shell (instead of creating a new copy), meaning any env variable changes will persist.
source ./myscript.sh
#OR using the . shortcut:
. ./myscript.sh
@hyharryhuang
hyharryhuang / restartGhost.sh
Created January 1, 2015 14:17
Restart Ghost Blog
sudo service nginx restart
sudo service ghost restart