Skip to content

Instantly share code, notes, and snippets.

View kylefritz's full-sized avatar

Kyle Fritz kylefritz

View GitHub Profile
@kylefritz
kylefritz / publishAmazonSnsMsg.py
Created October 18, 2010 22:06
publish a message to Amazon SNS using python or ruby
from time import strftime,gmtime,time
import urllib2
import hmac
import hashlib
import base64
import string
def publishAmazonSnsMsg(Subject,TopicArn,Message,AWSAccessKeyId,privatekey):
#http://docs.amazonwebservices.com/AWSSimpleQueueService/2008-01-01/SQSDeveloperGuide/
amzsnshost = 'sns.us-east-1.amazonaws.com'
require("../configure_enzyme");
//
// setup a mock for a function that depends on the current system time
//
import { pastDeadline } from "menu/pastDeadline";
jest.mock("menu/pastDeadline", () => {
let areWePastDeadline = true;
function __setPastDeadline(newValue) {
areWePastDeadline = newValue;
@kylefritz
kylefritz / s3.rake
Created April 15, 2020 17:25
Download blobs from s3 so can serve from active_storage.service = :local
require 'aws-sdk-s3'
namespace :s3 do
desc "Download blobs from s3 so can serve from active_storage.service = :local"
task :download => :environment do
s3 = Aws::S3::Client.new
bucket = '<bucket_name>' # TODO: your bucket name here
objects = s3.list_objects(bucket: bucket).contents
@kylefritz
kylefritz / gist:2159e6c1c8d6fb4971a5cc0e43497d01
Last active November 22, 2019 19:10
run command `arc lint` on each file changed in a branch
git diff -z --name-only master | xargs -0 -I FILE_PATH arc lint FILE_PATH
# -z delimits files with null character
# -0 gobbls the null character
# -I ANYTHING declares ANYTHING as the replacement token (to be filled with 1 file name)
#!/usr/bin/env bash
# set -x will make bash print/debug commands before it runs them.
set -eux -o pipefail
echo "yo"
exec ls -la ~/Desktop
@kylefritz
kylefritz / game.py
Created October 16, 2018 14:58
Alien shuffle for pygame zero
import random
alien = Actor('alien')
alien.topright = 0, 10
# these pieces of state needed to be attached to an actor to be updated...
alien.score = 0
alien.screen_color = 128, 80, 0
bad_alien = Actor('alien')
bad_alien.topright = 400, 10
@kylefritz
kylefritz / delete-stations.js
Last active April 25, 2018 16:17
delete all the stations in pandora
function clickDelete(){
$('.deleteStation').delay(800).click();
console.log("deleted station")
if( $('.stationListItem').length > 2 ){
setTimeout(clickDelete, 5000);
}
}
clickDelete();
@kylefritz
kylefritz / HandlebarsBundleTransform.cs
Created July 6, 2012 13:54
Compile Handlebars Templates in .net mvc
using System.IO;
using System.Text;
using System.Web;
using System.Web.Optimization;
using Jurassic;
using System.Globalization;
namespace Fewt.Web
{
@kylefritz
kylefritz / agile-the-good-parts.md
Created February 27, 2012 16:55
agile the good parts

#AGILE THE GOOD PARTS

  • Create a team, not a group of individuals
  • Context-switching should be avoided mercilessly
  • Try always to improve
  • If something is difficult or time-consuming, do it more often
  • Be merciless about achieving high quality
  • Do everything in tiny increments
  • Get customer Feedback Early and Often
select
date_trunc('day', enqueued_at) as enqueued_at
,last_stage
,count(*)
,round(percentile_cont(0.50) WITHIN GROUP (ORDER BY duration_minutes)) as p50
,round(percentile_cont(0.75) WITHIN GROUP (ORDER BY duration_minutes)) as p75
,round(percentile_cont(0.90) WITHIN GROUP (ORDER BY duration_minutes)) as p90
,round(percentile_cont(0.95) WITHIN GROUP (ORDER BY duration_minutes)) as p95
from queue_stat