Skip to content

Instantly share code, notes, and snippets.

View gms8994's full-sized avatar

Glen Solsberry gms8994

View GitHub Profile
@gms8994
gms8994 / 1.php
Created April 26, 2011 19:52
Benchmark Comparison
<?php
class Test {
public function test() {
return "abcd1234";
}
}
@gms8994
gms8994 / cdn_tester.sh
Created May 17, 2011 14:17
curl timer fetch stackexchange CDNs
#!/bin/bash
REPEAT=20
TIMER=0
function fetchTimer {
URL=$1
CURRENT_TIME=`curl --compressed -w '%{time_total}' -o /dev/null -s $URL`;
TIMER=`echo "$CURRENT_TIME + $TIMER" | bc`
<?xml version='1.0' encoding='UTF-8'?>
<accounts type='array'>
<account>
<id>44283</id>
<name></name>
<event-feed-uri>/events.rss</event-feed-uri>
<applications type='array'>
<application>
<id type='integer'>156463</id>
<name>NetworldAlliance</name>
May 30 08:55:13.470 [12381] dbg: logger: adding facilities: all, bayes, learn, dns
May 30 08:55:13.470 [12381] dbg: logger: logging level is DBG
May 30 08:55:13.470 [12381] dbg: generic: SpamAssassin version 3.3.2
May 30 08:55:13.470 [12381] dbg: generic: Perl 5.010001, PREFIX=/usr/local, DEF_RULES_DIR=/usr/local/share/spamassassin, LOCAL_RULES_DIR=/etc/mail/spamassassin, LOCAL_STATE_DIR=/var/lib/spamassassin
May 30 08:55:13.470 [12381] dbg: config: timing enabled
May 30 08:55:13.471 [12381] dbg: config: score set 0 chosen.
May 30 08:55:13.474 [12381] dbg: util: running in taint mode? yes
May 30 08:55:13.474 [12381] dbg: util: taint mode: deleting unsafe environment variables, resetting PATH
May 30 08:55:13.474 [12381] dbg: util: PATH included '/home/glens/bin', keeping
May 30 08:55:13.474 [12381] dbg: util: PATH included '/usr/local/bin', keeping
@gms8994
gms8994 / sql2xls.pl
Created July 25, 2012 14:07
Executes SQL commands against server; uploads results to Google Spreadsheets
#!/usr/bin/perl
# Allows the user to take the result of a series of SQL queries
# and place them in Google docs, so that data can be easily shared
# Author: Glen Solsberry <http://dp.cx/blog>
# Copyright: Public Domain
use warnings;
use strict;
@gms8994
gms8994 / gasmask_focus_mode
Created October 17, 2012 17:53 — forked from axelav/gasmask_focus_mode
Gasmask focus mode
0.0.0.0 twitter.com
0.0.0.0 mail.google.com
0.0.0.0 facebook.com
0.0.0.0 www.facebook.com
0.0.0.0 nytimes.com
0.0.0.0 www.nytimes.com
0.0.0.0 news.ycombinator.com
0.0.0.0 stellar.io
0.0.0.0 www.stellar.io
@gms8994
gms8994 / gist:3919797
Created October 19, 2012 18:21 — forked from adrienbrault/gist:1401812
Install coffee script compiler on CentOS

You are going to install some things. Login in root or use sudo for most of the followings commands.

su -

First you need git.

yum install git
tell application "Calendar"
tell calendar "Calendar"
set theStartDate to ((current date) - 1 * days)
set time of theStartDate to 1 * hours
set theEndDate to (current date)
set time of theEndDate to 1 * hours
set theEventListString to ""
set theEventList to every event where start date > theStartDate and end date < theEndDate
@gms8994
gms8994 / gist:4286098
Created December 14, 2012 15:05
crontab for calendar_logger.scpt
19 8 * * * exec /usr/bin/osascript "calendar_logger.scpt" | grep -v "^$" | sort -k4 -k3 -k6 -k5 | /usr/local/bin/dayone -d="yesterday" new
$app->hook('slim.before', function() use ($app){
$authenticated = $app->request()->headers('X-API-KEY') == API_KEY;
if(! $authenticated) {
throw new ApiException('Authentication failed');
}
});