Skip to content

Instantly share code, notes, and snippets.

Avatar

Harry Huang hyharryhuang

View GitHub Profile
@hyharryhuang
hyharryhuang / startPython.sh
Last active Aug 29, 2015
Easy Kill and Rerun Python Wrapper
View startPython.sh
STARTSCRIPT="run.py"
echo "Running script..."
sudo pkill -f $STARTSCRIPT
sudo python $STARTSCRIPT &
@hyharryhuang
hyharryhuang / ScriptTagAvoidProblems.htm
Created Jan 1, 2015
Avoiding problems with embedded < in scripts
View ScriptTagAvoidProblems.htm
<script type="text/javascript">
//<![CDATA[
//]]>
</script>
@hyharryhuang
hyharryhuang / IterateExample.js
Created Jan 12, 2015
Iterate through javascript Objects
View IterateExample.js
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 Jan 22, 2015
Javascript Map, Filter, Reduce Usage
View mapFilterReduce.js
var a = [1,2,3,4,5];
//MAP
var mapped = a.map(function(number) {
return number * 2;
});
console.log(mapped);
//FILTER
View SourceShell.sh
#!/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
View restartGhost.sh
sudo service nginx restart
sudo service ghost restart
You can’t perform that action at this time.