Skip to content

Instantly share code, notes, and snippets.

View samjsharpe's full-sized avatar

Sam J Sharpe samjsharpe

View GitHub Profile
#!/usr/bin/env ruby
require 'fastly'
service_id = 'deadbeefdeadbeef'
fastly = Fastly.new(:api_key => 'deadbeefdeadbeefdeadbeef')
service = fastly.get_service(service_id)
latest_version = service.version
@samjsharpe
samjsharpe / counter.awk
Created October 21, 2013 22:38
Quick script to parse a web log (in custom format) looking for three images (with|without|base)-js, counting the occurrences and spit out a report on the useragents that grabbed without-js. Usage: gawk -f counter.awk <logfile>
$7 ~ /(without|with|base)-js/ {
split($7,array,"-");
target_string=array[2];
split(target_string,array2,"/");
image=array2[2];
switch (image) {
case "with":
WITH+=1
break
case "without":
Enable Access for Assistive Devices (For Spectacle.app and Stay.app)
http://www.tekrevue.com/2013/06/25/how-to-enable-access-for-assistive-devices-in-os-x-mavericks/
---
foo: "%{hiera('bar')}"
bar: "%{hiera('baz')}"
baz: "blah"
#!/bin/bash
PSKYSCAPE="SKYSCAPEPASSWORD"
USKYSCAPE="SKYSCAPEUSERNAME"
PGDS="GDSPASSWORD"
UGDS="GDSUSERNAME"
function skyscape {
echo $PSKYSCAPE | sudo openconnect --passwd-on-stdin -b -q -u $USKYSCAPE --authgroup=CLIENT-VPN1 --no-cert-check vpn2.skyscapecloud.com >/dev/null 2>&1
}
@samjsharpe
samjsharpe / users.rb
Last active August 29, 2015 13:56
List github enterprise users
#!/usr/bin/env ruby
require 'rubygems'
require 'rest-client'
require 'json'
require 'pp'
scheme="https"
hostname="github.gds/api/v3"
username="yourgheusername"
password="yourghepassword"
[
{
"userName": "gds-operations",
"repo": "puppet-auditd"
},
{
"userName": "gds-operations",
"repo": "puppet-graphite"
},
{
[
{ "userName": "alphagov", "repo": "blinken" },
{ "userName": "alphagov", "repo": "boxes" },
{ "userName": "alphagov", "repo": "cdn-acceptance-tests" },
{ "userName": "alphagov", "repo": "ci-puppet" },
{ "userName": "alphagov", "repo": "cloudflare-configure" },
{ "userName": "alphagov", "repo": "fabric-scripts" },
{ "userName": "alphagov", "repo": "ghtools" },
{ "userName": "alphagov", "repo": "govuk_crawler_worker" },
{ "userName": "alphagov", "repo": "govuk_mirror-puppet" },
@samjsharpe
samjsharpe / gist:562e142d50cbf456a1e7
Created July 3, 2014 11:15
rspec-fails-on-puppet-syntax
/opt/rubies/1.9.3-p545/bin/ruby -S rspec ./spec/puppet-syntax/hiera_spec.rb ./spec/puppet-syntax/manifests_spec.rb ./spec/puppet-syntax/tasks/puppet-syntax_spec.rb ./spec/puppet-syntax/templates_spec.rb ./spec/puppet-syntax_spec.rb
PuppetSyntax::Hiera
should expect an array of files
should return nothing from valid YAML
should return an error from invalid YAML
PuppetSyntax::Manifests
should expect an array of files
should return nothing from a valid file
350,507d349
< window.templates["search/_results_block"]=new Hogan.Template(function(e
< t
< n){var r=this;return r.b(n=n||"")
< r.s(r.f("filter_fields"
< e
< t
< 1)
< e
< t