Skip to content

Instantly share code, notes, and snippets.

Ozzie Perez ozzieperez

Block or report user

Report or block ozzieperez

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ozzieperez
ozzieperez / run-detached-process.sh
Last active Jul 31, 2019
Ubuntu Linux: Run command independent/detached from your session so it continues after exiting
View run-detached-process.sh
# run the command with nohup
nohup npm run my-process &
# check that it's running
jobs
# detach your session from that job
disown -h %1
@ozzieperez
ozzieperez / split_by_silence.sh
Created Jul 1, 2018
Bash script to split an mp3 file from silent sections
View split_by_silence.sh
#!/bin/bash
# file name to be split
input=$1
# text to prepend to the file name of the slices
prepend=$2
# counter for the slices
slice_counter=1
# current start
start=0
@ozzieperez
ozzieperez / trie.py
Created Aug 6, 2017 — forked from nickstanisha/trie.py
An object-oriented implementation of a "Trie" in Python
View trie.py
class Node:
def __init__(self, label=None, data=None):
self.label = label
self.data = data
self.children = dict()
def addChild(self, key, data=None):
if not isinstance(key, Node):
self.children[key] = Node(key, data)
else:
@ozzieperez
ozzieperez / lightsail-docker.sh
Created Jun 7, 2017 — forked from davidkryzaniak/lightsail-docker.sh
Auto-Install Docker on AWS Lightsail
View lightsail-docker.sh
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt-get update
sudo apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
sudo apt-get install -y docker-engine
sudo service docker start
sudo docker pull php:5.6-apache
@ozzieperez
ozzieperez / .gitconfig
Created Mar 22, 2017 — forked from dahlbyk/.gitconfig
Windows Git Diff/Merge Tool Configuration
View .gitconfig
[alias]
dt = difftool
mt = mergetool
[diff]
tool = bc3
[difftool]
prompt = false
[difftool "bc3"]
cmd = \"c:/program files (x86)/beyond compare 3/bcomp.exe\" \"$LOCAL\" \"$REMOTE\"
[difftool "p4"]
@ozzieperez
ozzieperez / getCommandLineArgumentsInNode.js
Last active Jan 7, 2017
Get Command Line Arguments in Node
View getCommandLineArgumentsInNode.js
/* Example: Say you run this from the command line:
node myscript.js -color blue -names joe jenny -month september
You can get the arguments in your script by calling the following method as such:
var color = getCmdLineArgument("-color") //returns "blue"
var names = getCmdLineArgument("-names", 2) //returns ["joe", "jenny"]
var month = getCmdLineArgument("-month") //returns "september"
var ghost = getCmdLineArgument("-ghost") //returns null
@ozzieperez
ozzieperez / AddParametersToThis.html
Last active Sep 30, 2016
Add all constructor parameters for a JS class to "this" automatically
View AddParametersToThis.html
<html>
<head>
<script>
"use strict";
class BaseClass {
//Adds the parameters of a method to the context (this)
addParametersToThis() {
var parameters = this.getFunctionParameterNames(this.constructor);
@ozzieperez
ozzieperez / mongoGroupAggregateHelper.js
Created Sep 16, 2016
Creates a $group object for Mongo aggregate that adds all the properties of a Model object and any other additions.
View mongoGroupAggregateHelper.js
let Group = {
/*
* Description:
* Creates a $group object for Mongo aggregate that adds all the properties
* of a Model object and any other additions.
*
* Sample usage:
* MyCoolModel.aggregate({$match:{..}, {$group:Group.withModel(MyCoolModel, {count: { $sum: 1 }})} })
*
* Parameters:
@ozzieperez
ozzieperez / bash-cheatsheet.sh
Created Sep 9, 2016 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems
View bash-cheatsheet.sh
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@ozzieperez
ozzieperez / killprocs.sh
Last active Aug 27, 2016
Kill a comma-delimited list of processes
View killprocs.sh
#!/bin/bash
# ex: ./killprocs.sh Process1,Process2,Process3
# set the "internal field separator" variable (delimiter)
IFS=','
# read the delimited line into an array
read -ra PROCS <<< "$1"
# loop through the array
for i in "${PROCS[@]}"; do
# get the PID of the process
You can’t perform that action at this time.