Skip to content

Instantly share code, notes, and snippets.

@ozzieperez
ozzieperez / zsh_on_ubuntu.md
Last active March 5, 2016 10:17 — forked from tsabat/zsh.md
Getting oh-my-zsh to work in Ubuntu
@ozzieperez
ozzieperez / killprocs.sh
Last active August 27, 2016 08:31
Kill a comma-delimited list of processes
#!/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
@ozzieperez
ozzieperez / bash-cheatsheet.sh
Created September 9, 2016 04:28 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems
#!/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 / mongoGroupAggregateHelper.js
Created September 16, 2016 01:44
Creates a $group object for Mongo aggregate that adds all the properties of a Model object and any other additions.
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 / AddParametersToThis.html
Last active September 30, 2016 17:08
Add all constructor parameters for a JS class to "this" automatically
<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 / getCommandLineArgumentsInNode.js
Last active January 7, 2017 21:25
Get Command Line Arguments in Node
/* 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 / NumericValidationTrigger.cs
Last active February 3, 2017 14:35
Xamarin.Forms Trigger Example
// Visual elements can react to events or property changes.
// Triggers can be thought of for "conditional styles".
// Types: Trigger, EventTrigger, DataTrigger, MultiTrigger
//EXAMPLE: hooking trigger to a property
//You have a trigger that fires when a property changes
//create the trigger
var trigger = new Trigger(typeof(Entry));
trigger.Property = Entry.IsFocusedProperty; // hooked to the "IsFocused" property!
@ozzieperez
ozzieperez / .gitconfig
Created March 22, 2017 17:26 — forked from dahlbyk/.gitconfig
Windows Git Diff/Merge Tool Configuration
[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 / lightsail-docker.sh
Created June 7, 2017 05:06 — forked from davidkryzaniak/lightsail-docker.sh
Auto-Install Docker on AWS Lightsail
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 / trie.py
Created August 6, 2017 20:08 — forked from nickstanisha/trie.py
An object-oriented implementation of a "Trie" in Python
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: