Skip to content

Instantly share code, notes, and snippets.

View JeffreyHyer's full-sized avatar

Jeffrey Hyer JeffreyHyer

  • RainFocus
  • Lehi, UT
View GitHub Profile
@JeffreyHyer
JeffreyHyer / Vagrantfile
Created October 19, 2018 01:00
Vagrant Setup
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.provision "shell", path: "vagrant-bootstrap.sh"
config.vm.network "private_network", {
ip: "192.168.11.2",
}
config.vm.synced_folder ".", "/vagrant", disabled: true
04562b1a0e230ce0d2ffc65ee796e1a2112cc2c2a168b748725b2193c42201b3a8bea09a7d854ea5236b4c23c9a8fbadca4291084dbe487400672c34d083a8e1bf;Xeoncross
@JeffreyHyer
JeffreyHyer / keybase.md
Last active September 21, 2017 18:55
keybase.md

Keybase proof

I hereby claim:

  • I am jeffreyhyer on github.
  • I am jeffreyhyer (https://keybase.io/jeffreyhyer) on keybase.
  • I have a public key ASA-c1NxXPfEiqK6Qgkgp-qnmWLtEkDB47rLDHj9aCcKDwo

To claim this, I am signing this object:

@JeffreyHyer
JeffreyHyer / mysql_backup.sh
Last active June 20, 2017 17:09
Backup a MySQL database automatically via a cron task
#!/bin/bash
############################
# Usage: ./mysql_backup.sh
#
# Crontab: 0 * * * * bash /home/[USERNAME]/mysql_backup.sh (hourly at the top of the hour)
# 0 0 * * * bash /home/[USERNAME]/mysql_backup.sh (daily at midnight)
############################
# The current date and time (e.g. 201706141700, YYYYMMDDHHMM)
ts=$(date +%Y%m%d%H%M)
@JeffreyHyer
JeffreyHyer / Fireworks.js
Created June 19, 2017 14:54
Launch fireworks in the browser using a canvas element to render the animated rockets/particles on the screen.
/**
* Adapted from the original source at: https://jsfiddle.net/dtrooper/AceJJ/
*
* + Refactored to add support for ES6 classes, functions, and modules.
* - Removed support for using the mouse position/events to control the fireworks
*
* Draws a canvas over the entire width/height of the screen and launches
* fireworks until told to stop.
*
* Usage:
@JeffreyHyer
JeffreyHyer / whimper.js
Created October 9, 2016 01:38
Whimper Notifications (not quite Growl notifications)
var whimper = {
timers: {},
counter: 0,
init: function() {
var div = document.createElement('div');
div.id = "whimper-container";
document.body.appendChild(div);
},
/**
* webMercatorToLatLong
*
* Convert supplied Web Mercator coordinates to WGS84-compatible latitude and longitude coordinates.
*
* Sources: http://www.neercartography.com/latitudelongitude-tofrom-web-mercator/
* https://developers.arcgis.com/javascript/3/jsapi/esri.geometry.webmercatorutils-amd.html#xytolnglat
*
* @param double x The X coordinate in Web Mercator format
* @param double y The Y coordinate in Web Mercator format
<?php
/**
* Generate a human-friendly fraction approximation given a nasty-looking
* number with lots of digits after the decimal point.
*
* @param double $number The number for which to calculate the nearest friendly fraction
* @param boolean $string Return the human-readable string of the fraction (default)
* or return an array of the fractions parts (whole number, numerator,
* and denominator)
@JeffreyHyer
JeffreyHyer / multi_key_crypto.sh
Created July 30, 2016 02:01 — forked from kennwhite/multi_key_crypto.sh
OpenSSL command line recipe for multi-public key file encryption. Any single private key paired to one of the public keys can decrypt the file.
#!/usr/bin/env bash
#
# Example of multiple key AES encryption for text files using the openssl v. 0.9.8+ command line utility
# Uses n public certs as key for MIME PKCS envelope, any individual private key can decrypt.
#
# If standard RSA ssh keys exist, these can be converted to public certs as well (and ssh keys can decrypt)
#
# To sign (and verify) the encrypted file, one of the private keys is required, see:
# http://www.openssl.org/docs/apps/smime.html#EXAMPLES for openssl smime examples
# or http://www.openssl.org/docs/apps/cms.html#EXAMPLES for cms utility (OpenSSL v. 1.0+)
@JeffreyHyer
JeffreyHyer / vagrant_bootstrap.sh
Created December 15, 2015 16:19 — forked from rrosiek/install_mysql.sh
Vagrant provision script for php, Apache, MySQL, phpMyAdmin, Laravel, and javascript helpers. Outputs nearly everything to /dev/null since "quiet" on most commands is still noisy.
#! /usr/bin/env bash
# Variables
APPENV=local
DBHOST=localhost
DBNAME=dbname
DBUSER=dbuser
DBPASSWD=test123
echo -e "\n--- Mkay, installing now... ---\n"