Skip to content

Instantly share code, notes, and snippets.

View shanonvl's full-sized avatar
🚀

Shanon Levenherz shanonvl

🚀
View GitHub Profile
@shanonvl
shanonvl / mysql-create-database.sql.tpl
Created March 14, 2014 17:45
MySQL: Create Database
CREATE DATABASE `mydb` CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT ALL ON `mydb`.* TO `username`@localhost IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
-- Alternatively, you can use ‘CREATE SCHEMA’ instead of ‘CREATE DATABASE’:
-- CREATE SCHEMA `mydb` CHARACTER SET utf8 COLLATE utf8_general_ci;
-- GRANT ALL ON `mydb`.* TO `username`@localhost IDENTIFIED BY 'password';
-- FLUSH PRIVILEGES;
@shanonvl
shanonvl / paste-clipboard-to-password-dialog.ascript
Last active August 29, 2015 14:19
Enable Pasting of Clipboard Contents into Secure
# 1. Open Script Editor
# 2. Paste the below into the editor
tell application "System Events" to tell process "SecurityAgent"
set value of text field 1 of window 1 to (the clipboard)
click button 1 of group 1 of window 1
end tell
# 3. Execute action that pops the password dialog e.g. `ssh example.com`
@shanonvl
shanonvl / module-exists.js
Last active October 23, 2015 15:10
Check for exists via Aurelia loader
import {inject} from 'aurelia-dependency-injection';
import {Loader} from 'aurelia-loader';
@inject(Loader)
class Exists {
constructor(loader) {
this.loader = loader;
}
/**
@shanonvl
shanonvl / neo4j-enterprise.rb
Last active March 29, 2017 15:25 — forked from jtescher/neo4j-enterprise.rb
Neo4j Enterprise Homebrew Formula
require 'formula'
class Neo4jEnterprise < Formula
homepage 'http://www.neo4j.org/'
url "http://dist.neo4j.org/neo4j-enterprise-3.1.3-unix.tar.gz"
sha256 'b784a61228bdc31cbc843009e4d36d3e2aee7662f8b40bd608b8759de26b77d5'
version "3.1.3"
devel do
url "http://dist.neo4j.org/neo4j-enterprise-3.1.3-unix.tar.gz"
@shanonvl
shanonvl / visitor.js
Last active May 18, 2017 20:49
Visitor Pattern impl for JSON
function traverse(o,func,parentPath = '') {
Object.keys(o).forEach(i => {
func.apply(this,[i,o[i],parentPath, o]);
if (o[i] !== null && typeof(o[i])=="object") {
//going one step down in the object tree!!
traverse(o[i],func, parentPath ? `${parentPath}:${o.clientId || o.name || i}` : o.clientId || o.name || i);
}
});
}

GitHub API Cheat Sheet

Setup

  • Identify/acquire a valid GitHub Personal Access Token (PAT)
  • Set GITHUB_USER and GITHUB_API_TOKEN e.g. via the following snippet
GITHUB_USER=<username>
GITHUB_API_TOKEN=<PAT goes here>
export GITHUB_USER GITHUB_API_TOKEN 
@shanonvl
shanonvl / snippets.md
Last active July 23, 2017 21:39
MacOS Snippets

MacOS Snippets

Helpful snippets for OSX / MacOS

Mount a RAM disk

ram://2097152 is the size, calculated as follows: * 2048.

1gb: diskutil erasevolume HFS+ 'ram-disk' `hdiutil attach -nomount ram://2097152`
2gb: diskutil erasevolume HFS+ 'ram-disk' `hdiutil attach -nomount ram://4194304`
3gb: diskutil erasevolume HFS+ 'ram-disk' `hdiutil attach -nomount ram://6291456`
4gb: diskutil erasevolume HFS+ 'ram-disk' `hdiutil attach -nomount ram://8388608`
@shanonvl
shanonvl / keybase.md
Created July 31, 2017 22:51
Keybase Proof

Keybase proof

I hereby claim:

  • I am shanonvl on github.
  • I am shanonvl (https://keybase.io/shanonvl) on keybase.
  • I have a public key ASCeYUn9s0AoKsuBDbaxOBIa7upc6KxggXi2yocMzwy5Fwo

To claim this, I am signing this object:

@shanonvl
shanonvl / vmware-static-ip.sh
Last active August 11, 2017 01:22
VMWare Fusion 8 - Configure Static IP
#!/bin/bash
#
# Configures a static IP for a VMware Fusion (currently 8.0) virtual machine
#
# Usage:
#
# sudo ./vmware-static-ip.sh <path-to-vmwarevm-dir>
# eg. sudo ./vmware-static-ip.sh "/Volumes/Data/Virtual Machines/plusamp-ubuntu-16.04-amd64-docker.vmwarevm"
#
@shanonvl
shanonvl / grownyc_cla.md
Created September 28, 2017 15:45
GrowNYC CLA

Contributor License Agreement

The following terms are used throughout this agreement:

  • You - the person or legal entity including its affiliates asked to accept this agreement. An affiliate is any entity that controls or is controlled by the legal entity, or is under common control with it.

  • Project - is an umbrella term that refers to any and all GrowNYC (d/b/a Council on the Environment of New York City) projects.

  • Contribution - any type of work that is submitted to a Project, including any modifications or additions to existing work.

  • Submitted - conveyed to a Project via a pull request, commit, issue, or any form of electronic, written, or verbal communication with GrowNYC, contributors or maintainers.