Skip to content

Instantly share code, notes, and snippets.

View lawrencejones's full-sized avatar

Lawrence Jones lawrencejones

View GitHub Profile
@lawrencejones
lawrencejones / ListBucket.hs
Created November 7, 2017 13:32
Iterate through a public S3 bucket and print all elements
#!/usr/bin/env stack
-- stack --resolver lts-9.8 --install-ghc runghc --package http-conduit --package xml
{-# LANGUAGE OverloadedStrings #-}
import System.Environment (getArgs)
import Network.HTTP.Simple
import Data.ByteString.Char8 (pack)
import Text.XML.Light
import Data.Maybe
import Data.List (intercalate)
@lawrencejones
lawrencejones / skylight_vagrant_test.output
Created August 19, 2017 14:43
Ruby 1.9.3 run of Skylight ruby tests, imitating travis in a vagrant machine. Runs successfully while travis fails
vagrant@vagrant-ubuntu-trusty-64:~/skylight-ruby$ bundle
Fetching gem metadata from http://rubygems.org/..............
Fetching version metadata from http://rubygems.org/...
Fetching dependency metadata from http://rubygems.org/..
Resolving dependencies....
Using rake 12.0.0
Using i18n 0.6.11
Using multi_json 1.12.1
Using builder 3.0.4
Using erubis 2.7.0
@lawrencejones
lawrencejones / query.rb
Created August 9, 2017 16:50
Auto-paginated results from kibana
gem 'excon'
require 'excon'
require 'json'
# This is an example of a query that you might execute against Kibana, to find all logs
# that contain the string "Refusing to cancel"
#
# You should probably execute this script piping the output to jq, like so:
#
# $ ruby query.rb /path/to/query.json | jq '.[0]'
func TestSupervise_ensureServiceRunning_cannotCheckMoreThanOnceConcurrently(testing *testing.T) {
authServiceOne := createAuthService()
authServiceTwo := createAuthService()
lockfile, err := generateTempLockfile(); if err != nil {
testing.Fatalf("failed to generate testing lockfile: %s\n", err)
return
}
// We need to use Name() here so that each lock is associated with a different

Keybase proof

I hereby claim:

  • I am lawrencejones on github.
  • I am lawrjone (https://keybase.io/lawrjone) on keybase.
  • I have a public key ASC_POuZ6Yv_kHIVgyJgyScCvx_GKtO0Yw0AxEP1c7zjDgo

To claim this, I am signing this object:

@lawrencejones
lawrencejones / Makefile
Created June 3, 2016 15:33
Example latex Makefile with bibtex support
.PHONY: clean
TEX_FILES:=$(shell find . -name "*.tex" -type f)
RESOURCE_FILES:=$(shell find ./res -type f)
report.pdf: $(TEX_FILES) $(RESOURCE_FILES) libtex/report.bbl
cd libtex && ( \
pdflatex -shell-escape report \
) && \
mv report.pdf ../
@lawrencejones
lawrencejones / apriori.json
Created May 31, 2016 11:15
Benchmarking results of Apriori and FP-Growth
[
{
"min_support": 30,
"duration": 2.53
},
{
"min_support": 29,
"duration": 2.56
},
{
lawrencejones at MacBookPro in .../lawrencejones/Projects/rails on (master)
λ ~> time g log --oneline -- README.md
7bbc6d6 Fix links in README for code [ci skip]
051b00c Merge pull request #17264 from claudiob/add-activejob-to-readme
b0ecbc8 Link to ActiveModel’s README in "Welcome to Rails"
8d66866 Add ActiveJob to "Welcome to Rails" section
d9b1c9b Update README.md
57fe5fd [ci skip] update wiki link for MVC
752e7a1 Use SVG version of travis build status badge [skip ci]
4f5aff9 updated Travis build status image url
@lawrencejones
lawrencejones / all_activities.rb
Last active March 7, 2023 20:29
Abusing the Strava API to achieve basic functionality
require 'oauth'
require 'uri'
require 'sinatra/base'
require 'pry'
require 'unirest'
require 'strava/api/v3'
module Strava
class Authorizer < Sinatra::Base
TOKEN_FILE = File.join(ENV['HOME'], '.strava_token')
@lawrencejones
lawrencejones / crypto.js
Created March 10, 2016 20:24
Exploitable crypto js code. Three exploits, one if you can load code before this module, one if you control the parameter passed to CryptoAPI.sha1.hash, and one if you can load code after this module
var CryptoAPI = (function() {
var encoding = {
a2b: function(a) { },
b2a: function(b) { }
};
var API = {
sha1: {
name: 'sha1',
identifier: '2b0e03021a',