Skip to content

Instantly share code, notes, and snippets.

View ssx's full-sized avatar

Scott Robinson ssx

View GitHub Profile
Answers Needed:
1. What Name generally has the most spaces
2. What time of day is 'name' likely to have spaces
3. What name generally has the least spaces
Date Time Name Spaces
2014-10-01 10:00:00 Item 1 753
2014-10-01 10:00:00 Item 2 436
Test String:
< echo "Hello O'Test"; ?>
FILTER_SANITIZE_STRING:
string(0) ""
FILTER_UNSAFE_RAW with flags: FILTER_FLAG_STRIP_LOW,
FILTER_FLAG_STRIP_HIGH,
FILTER_FLAG_ENCODE_LOW,
FILTER_FLAG_ENCODE_HIGH,

Keybase proof

I hereby claim:

  • I am ssx on github.
  • I am ssx (https://keybase.io/ssx) on keybase.
  • I have a public key whose fingerprint is F09E ADA7 71CD 1D46 9AB2 53A0 7C74 DD9C 936C 050C

To claim this, I am signing this object:

<?php
$code = \Input::get('go');
$twitterService = OAuth::consumer('twitter');
if (\Input::get('oauth_token')) {
$token = $twitterService->getStorage()->retrieveAccessToken('twitter');
$twitterService->requestAccessToken(
\Input::get('oauth_token'),
\Input::get('oauth_verifier'),
$token->getRequestTokenSecret()
@ssx
ssx / interfaces.php
Created September 7, 2013 16:57
An introduction taken from Taylor's Laravel book and extended to display the useful nature of interfaces.
<?php
header("Content-Type: text/plain");
interface BillerInterface {
public function bill(array $user, $amount);
}
interface BillingNotifierInterface {
public function notify(array $user, $amount);
}
#!/bin/bash
unload() {
kextstat | grep "org.virtualbox.kext.VBoxUSB" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxUSB
kextstat | grep "org.virtualbox.kext.VBoxNetFlt" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxNetFlt
kextstat | grep "org.virtualbox.kext.VBoxNetAdp" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxNetAdp
kextstat | grep "org.virtualbox.kext.VBoxDrv" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxDrv
}
load() {
#!/bin/bash
# herein we backup our indexes! this script should run at like 6pm or something, after logstash
# rotates to a new ES index and theres no new data coming in to the old one. we grab metadatas,
# compress the data files, create a restore script, and push it all up to S3.
TODAY=`date +"%Y.%m.%d"`
INDEXNAME="logstash-$TODAY" # this had better match the index name in ES
INDEXDIR="/usr/local/elasticsearch/data/logstash/nodes/0/indices/"
BACKUPCMD="/usr/local/backupTools/s3cmd --config=/usr/local/backupTools/s3cfg put"
BACKUPDIR="/mnt/es-backups/"
YEARMONTH=`date +"%Y-%m"`
@ssx
ssx / gist:5338826
Created April 8, 2013 17:44
Chrome + JS: Harlem Shake
Using Google Chrome.
Go to a website.
Right click on the page somewhere.
Click inspect element
Click the console tab
Scotts-MacBook-Air:~ scott$ traceroute google.com
traceroute: Warning: google.com has multiple addresses; using 173.194.34.136
traceroute to google.com (173.194.34.136), 64 hops max, 52 byte packets
1 192.168.0.1 (192.168.0.1) 6.925 ms 6.713 ms 7.589 ms
2 10.93.176.1 (10.93.176.1) 45.988 ms
bagu-core-2b-ae3-2365.network.virginmedia.net (80.5.167.229) 60.279 ms 33.725 ms
3 leed-bb-1b-ae7-0.network.virginmedia.net (80.5.161.245) 60.188 ms 31.955 ms 27.104 ms
4 leed-bb-1c-ae1-0.network.virginmedia.net (62.253.174.26) 81.292 ms 156.878 ms 134.829 ms
5 teln-ic-2-ae1-0.network.virginmedia.net (212.250.14.146) 176.878 ms 266.475 ms 381.205 ms
6 72.14.195.206 (72.14.195.206) 446.911 ms
@ssx
ssx / week-timestamps.php
Created May 13, 2012 10:25
Week Start & End Timestamps
<?php
// This creates a date string in the format YYYY-WNN, which is
// a four digit year followed by a hyphen and letter W then the
// two digit week number
$strtotime = date("o-\WW");
// The $start timestamp contains the timestamp at 0:00 on the
// Monday at the beginning of the week
$start = strtotime($strtotime);