Skip to content

Instantly share code, notes, and snippets.

View caseyscarborough's full-sized avatar

Casey Scarborough caseyscarborough

View GitHub Profile
@caseyscarborough
caseyscarborough / PandocMakefile
Created December 2, 2013 15:58
A generic Makefile that I use to compile PDFs using Pandoc.
MD_FILE=infile.md
PDF_FILE=outfile.pdf
LATEX_ENGINE=xelatex
MAIN_FONT=Georgia
SANS_FONT=Arial
MONO_FONT=Consolas
FONT_SIZE=11pt
PANDOC_OPTIONS=\
# Gitignore file for Grails application with IntelliJ
# Ignore IDE specific files
/.idea/
/*.iml
/.classpath
/.project
# Ignore builds
target/
@caseyscarborough
caseyscarborough / ubuntu-server-12.04.sh
Created September 26, 2013 14:47
This Gist will automatedly install GitLab v6.1 on a freshly installed Ubuntu Server 12.04 or 13.04. See https://github.com/caseyscarborough/gitlab-install for more info.
#!/bin/bash
# Unattended GitLab Installation for Ubuntu Server 12.04 and 13.04 64-Bit
#
# Maintainer: @caseyscarborough
# GitLab Version: 6.1
#
# This script installs GitLab server on Ubuntu Server 12.04 or 13.04 with all dependencies.
#
# INFORMATION
# Distribution : Ubuntu 12.04 & 13.04 64-Bit
@caseyscarborough
caseyscarborough / Solvable.java
Last active December 2, 2019 18:45
This class shows how to determine if a 3x3 sliding puzzle is solvable or not.
/**
* This class represents how to determine the solvability
* of a 3 x 3 sliding puzzle.
*
* @author Casey Scarborough
*/
public class Solvable {
public static void main(String[] args) {
@caseyscarborough
caseyscarborough / CD.vbs
Created September 11, 2013 23:58
This script, run on a Windows machine, will wait 10 minutes, then start ejecting the CD drive every 2 minutes.
Set oWMP = CreateObject("WMPlayer.OCX.7")
Set colCDROMs = oWMP.cdromCollection
wscript.sleep 600000
do
if colCDROMs.Count >= 1 then
For i = 0 to colCDROMs.Count - 1
colCDROMs.Item(i).Eject
Next
For i = 0 to colCDROMs.Count - 1
colCDROMs.Item(i).Eject
@caseyscarborough
caseyscarborough / MongoDBTest.java
Last active December 21, 2015 22:19
A sample class showing basic usage of the MongoDB Java driver.
import com.mongodb.MongoClient;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import com.mongodb.DBCursor;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Set;
@caseyscarborough
caseyscarborough / instagram.rb
Last active December 21, 2015 16:08
An example application using the instagram_api gem.
require 'sinatra'
require 'instagram_api'
# Go to http://instagram.com/developer to get your client ID and client secret.
CLIENT_ID = "YOUR CLIENT ID"
CLIENT_SECRET = "YOUR CLIENT SECRET"
# Set the redirect uri for your application to the following:
REDIRECT_URI = "http://localhost:4567/callback"
@caseyscarborough
caseyscarborough / about.md
Created August 18, 2013 03:20 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@caseyscarborough
caseyscarborough / network_location.applescript
Last active October 4, 2021 11:12
This is an AppleScript that is used to change your network location. It can be assigned to a shortcut using Automator.
try
set network_location to do shell script ("scselect | awk '{if ($1==\"*\") print $3}' | sed 's/[()]//g'")
on error
display dialog "There was an error with the script."
end try
if network_location is "LocationA" then
do shell script "scselect LocationB"
else if network_location is "LocationB" then
do shell script "scselect LocationA"
@caseyscarborough
caseyscarborough / random.rb
Created August 6, 2013 20:36
Ruby snippet to test the fastest method of generating alphanumeric strings.
require 'benchmark'
n = 10_000_000
puts "\nGenerating random string of length #{n}:"
Benchmark.bm(9) do |x|
x.report('Method 1: ') do
range = [('a'..'z'),('A'..'Z'),('0'..'9')].map{ |i| i.to_a }.flatten
(0...n).map{ range[rand(range.length)] }.join