Skip to content

Instantly share code, notes, and snippets.

View davidjb's full-sized avatar

David Beitey davidjb

View GitHub Profile
@davidjb
davidjb / fix-centos6-vagrant.sh
Created August 23, 2017 23:24
Fix vagrant configuration
sudo wget http://download.virtualbox.org/virtualbox/4.3.30/VBoxGuestAdditions_4.3.30.iso -O vbox.iso
sudo mount -o loop vbox.iso /media
sudo /media/VBoxLinuxAdditions.run uninstall
sudo yum install -y kernel kernel-devel
# Now, reboot and vb-guest will auto-install the correct version
@davidjb
davidjb / inject.js
Created January 5, 2017 05:21
Adding JS/CSS into a live page
// These could be anything
var js = 'https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/jquery.magnific-popup.min.js'
var css = 'https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.css'
$.getScript(js)
$('body').append('<link href="' + css + '" rel="stylesheet">')
@davidjb
davidjb / recovery.sh
Created December 21, 2016 08:21
Create macOS Sierra Recovery Partition Without Reinstalling
TARGET="/Volumes/Macintosh HD" # Specify where to configure Recovery partition
MACOS_INSTALLER="/Applications/Install\ macOS\ Sierra.app" # Path to your macOS installer
# Remaining paths ahead are dependant on OS version
# This *should* support 10.9 and above but is only tested on 10.12
curl http://support.apple.com/downloads/DL1464/en_US/RecoveryHDUpdate.dmg -L -o ~/Downloads/RecoveryHDUpdate.dmg
hdiutil mount ~/Downloads/RecoveryHDUpdate.dmg
pkgutil --expand /Volumes/Mac\ OS\ X\ Lion\ Recovery\ HD\ Update/RecoveryHDUpdate.pkg /tmp/recoveryupdate
@davidjb
davidjb / readme.md
Created September 29, 2016 04:05
Certbot install and certificate renewal for nginx
  • Install Certbot (via https://certbot.eff.org/)

  • Insert this into /etc/crontab:

    /usr/local/bin/certbot-auto renew --renew-hook "service nginx reload" --no-self-upgrade -v >> /var/log/letsencrypt/renew.log 2>&1

Check to make sure everything is working okay. This should cause nginx to auto-reload whenever there's a new cert.

@davidjb
davidjb / nbsp-bug.html
Created August 2, 2016 00:52
Squiz Matrix Viper &nbsp; bug
<!-- When the following snippet is pasted into the source code editor, this code
including the whitespace indentation (which fits into a well-formatted HTML document):
-->
<p class="card-text">
With temperatures near 30&deg;C and 600mm of rain a year, Fletcherview has a dry
season of 6 to 9 months.
</p>
<!-- turns into this. Note the &nbsp; chars break the layout: -->
<p class="card-text">
@davidjb
davidjb / snippets.css
Last active August 13, 2017 08:29
CSS Snippets
/* Large ol numbering in the background */
.trip-steps {
counter-reset: step-counter;
margin-left: 3.5rem;
position: relative;
margin-top: 3rem;
margin-bottom: 3rem;
}
.trip-step {
position: relative;
@davidjb
davidjb / food-rescue-documentation.md
Last active June 15, 2016 12:29
Documentation for the Food Rescue project

Background

From the main BFR Robot Google Doc for administrators:

From the volunteer’s perspective, the robot is a fairly simple tool that magically understands which shift they’ve decided to do, and sends them email (or text message) reminders to do it and to subsequently enter data for it. It also shows cool statistics about how much food has been rescued, gives bike friendly directions between donors and recipients, keeps track of contact

@davidjb
davidjb / melody.c
Created May 16, 2016 22:58
Arduino random tone player
#include "Arduino.h"
#include "tones.h"
const int LED_PIN = 13;
const int BUTTON_PIN = 2;
const int PIEZO_PIN = 8;
int current_tone;
boolean playing = false;
@davidjb
davidjb / sec.py
Created April 22, 2016 13:42
Security Engineering Python Code (COMP3/9441)
# Warmup
ciphertext = "TGPRGWTADEKI HI3OYNODONAT ES4LOCIINTB} FC4LURSDTHO_ LO1IRYAEEIU_ AM{NOPBAVNT_"
letter_sets = [[l for l in w] for w in ciphertext.split()]
print(''.join(''.join(w) for w in zip(*x)))
$(document).ready(function() {
$(".globalheader a").click(function() {
if($(this).attr('href').toLowerCase() != "javascript:;" && $(this).attr('href') != "#") {
ga('send', 'event', {
eventCategory: 'Global Header',
eventAction: 'open',
eventLabel: $(this).attr('href'),
transport: 'beacon'
});
}