Skip to content

Instantly share code, notes, and snippets.

View aeppert's full-sized avatar

Aaron Eppert aeppert

View GitHub Profile
#!/usr/bin/osascript
-- Author: David Koppstein
-- Version 1.0
-- A script for backing up named Calendars from iCal using the GUI interface. Currently,
-- it relies on the fact that exported calendars go to a default directory. Future versions,
-- if they ever come out, will hopefully take care of this issue. Furthermore, this program
-- also assumes that there is already a backed-up .ics file of the same name in that directory.
--
-- While the script is running, be sure not to click anything.
--
#!flask/bin/python
from flask import Flask, jsonify, abort, request, make_response, url_for
from flask.ext.httpauth import HTTPBasicAuth
app = Flask(__name__, static_url_path = "")
auth = HTTPBasicAuth()
@auth.get_password
def get_password(username):
if username == 'miguel':
@aeppert
aeppert / gist:b57cb541d0a290837bf2
Last active August 29, 2015 14:24
Template for string conversion with padding and prefix facility
#include <iostream>
#include <sstream>
#include <string>
#include <limits>
using namespace std;
template <class T> std::string to_string(T t, ios_base & (*f)(ios_base&), std::string prefix = "", bool pad = true)
{
std::ostringstream oss;
@aeppert
aeppert / gist:00b1c97009a21c8eabe7
Created July 6, 2015 14:49
Build central to the root directory of the current Git repository
ROOTDIR=$(shell git rev-parse --show-toplevel)
@aeppert
aeppert / gist:1fda3505ea2376547e49
Created July 17, 2015 14:30
Access Class Name Internally.
#!/usr/bin/python
class testing:
def __init__(self):
pass
def get_name(self):
return self.__class__.__name__
t = testing()
print 't\'s class name is - \"%s\"' % (t.get_name())
@aeppert
aeppert / start_cifv2.sh
Last active August 29, 2015 14:27
Start CIFv2 in Docker with boot2docker on OS X
#!/bin/sh
#
# Aaron Eppert (aeppert@gamil.com)
#
# Wrapper script for starting the cifv2 Docker image via boot2docker
#
# NOTE: This assumes "boot2docker start" was run previously.
#
VBoxManage controlvm "boot2docker-vm" natpf1 "cifv2_forward_5000,tcp,,5000,,5000"
VBoxManage controlvm "boot2docker-vm" natpf1 "cifv2_forward_443,tcp,,8443,,443"
@aeppert
aeppert / calc.sh
Created August 11, 2015 19:39
Math on the command line
calc(){ awk "BEGIN{ print $* }" ;}
@aeppert
aeppert / cif.conf
Created August 19, 2015 15:53
NGINX Configuration for massive-octo-spice
server {
listen 80 default_server;
listen 443 ssl;
server_name 127.0.0.1; #_;
gzip on;
gzip_comp_level 2;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 1100;
@aeppert
aeppert / multiplicity_act.py
Created August 27, 2015 13:03
Python shell for having a singular script, via symlink, have multiple personalities easily.
#!/usr/bin/python
import sys
import os
from optparse import OptionParser
class cli_handlers(object):
def __init__(self, argv):