Skip to content

Instantly share code, notes, and snippets.

View jacobbednarz's full-sized avatar
💭
I may be slow to respond.

Jacob Bednarz jacobbednarz

💭
I may be slow to respond.
View GitHub Profile
#!/usr/bin/env bash
#
# Generate a random mac address, the old fashioned way.
# Ensure we are running as root.
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root." 2>&1
exit 1
fi
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "YOUR CUSTOM BOX NAME HERE"

Keybase proof

I hereby claim:

  • I am jacobbednarz on github.
  • I am jacobbednarz (https://keybase.io/jacobbednarz) on keybase.
  • I have a public key whose fingerprint is CBBB 1C47 F33B B260 2A95 E27A F2E3 5169 6395 DFBD

To claim this, I am signing this object:

@jacobbednarz
jacobbednarz / gist:2196919
Created March 25, 2012 15:03
Dynamically update age
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title></title>
</head>
<body>
<p>My age is: <span id="age"></span></p>
</body>
@jacobbednarz
jacobbednarz / example.html
Created April 1, 2012 12:09
100% CSS div height
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>100% CSS div height</title>
<style>
html, body { height: 100%; }
#left_panel { height: 100%; }
</style>
</head>
#!/usr/bin/ruby
# Output a prettier version of the number
def prettify_number(number)
formatted_output = number.to_s.gsub(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1 ")
end
# Get the free space of a drive
def get_free_space(path)
bash_listing = `df -h #{path} | grep ^/ | awk '{ print $4;}'`
# Found at: https://github.com/defunkt/zippy/blob/master/lib/zippy.rb
# ♥
%w( rubygems cgi hpricot net/http open-uri ).each { |f| require f }
@jacobbednarz
jacobbednarz / gist:2755240
Created May 20, 2012 06:13
Removed file extensions using .htaccess
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
total 120
drwxr-xr-x 13 Jacob staff 442 17 Nov 14:42 .
drwxr-xr-x 9 Jacob staff 306 17 Nov 14:42 ..
-rw-r--r-- 1 Jacob staff 171 17 Nov 14:42 cloudinary.yml
-rw-r--r-- 1 Jacob staff 580 17 Nov 14:42 database.yml
-rw-r--r-- 1 Jacob staff 381 17 Nov 14:42 database_migrations.yml
drwxr-xr-x 10 Jacob staff 340 17 Nov 14:42 google-api-private-keys
-rw-r--r-- 1 Jacob staff 1835 17 Nov 14:42 paypal-api-certificate.live.pem
-rw-r--r-- 1 Jacob staff 874 17 Nov 14:42 paypal.production.yml
-rw-r--r-- 1 Jacob staff 271 17 Nov 14:42 redis.yml
@jacobbednarz
jacobbednarz / drupal-quick-dump.sh
Created May 8, 2013 05:13
Dump MySQL tables excluding certain tables.
#!/bin/bash
# Take a MySQL DB dump excluding some tables.
#
# Usage:
# ./drupal-quick-dump user host database
USER="$1"
HOST="$2"
DB="$3"
DATE=`date +%Y%m%d`