Skip to content

Instantly share code, notes, and snippets.

View joeSaad's full-sized avatar

Joe Saad joeSaad

View GitHub Profile
@joeSaad
joeSaad / Terminate port service
Created July 24, 2017 21:13
terminate server running at certain port by just typing killport <portnumber> ... create this as a shell script, chmod 700 killport and place it in your /usr/local/bin folder
lsof -i:$1 | grep LISTEN | awk '{print $2}' | xargs kill -9
echo "port $1 has been terminated"
@joeSaad
joeSaad / bash
Created July 28, 2017 01:27
kill process for jboss on mac
ps -ef | grep jboss | grep -v grep | awk '{print $2}' | xargs kill -9
@joeSaad
joeSaad / automate1.app
Last active July 30, 2017 23:08
Run shell script using an automator
on run {input, parameters}
tell application "Terminal"
if not (exists window 1) then reopen
activate
do script "test1" in window 1
delay 2
close window 1
end tell
return input
@joeSaad
joeSaad / flattenArray.js
Created August 8, 2017 16:36
Flatten an array
function flattenMyArr(nArr) {
for (let i = 0; i < nArr.length; i++) {
if (Array.isArray(nArr[i])) {
flattenMyArr(nArr[i])
} else {
flatArr.push(nArr[i])
}
}
return flatArr;
}
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "cmd+k cmd+c",
"command": "editor.action.addCommentLine",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "cmd+k cmd+c",
"command": "-editor.action.addCommentLine",