Skip to content

Instantly share code, notes, and snippets.

View cogwirrel's full-sized avatar

Jack Stevenson cogwirrel

View GitHub Profile
{
"openapi": "3.0.2",
"info": {
"title": "MyApi",
"version": "1.0",
"description": "A sample api"
},
"paths": {
"/example": {
"get": {
@cogwirrel
cogwirrel / stream.sh
Created March 8, 2020 07:10
start up the kinesis stream sample app
#!/bin/bash
export AWS_ACCESS_KEY_ID="<Access Key ID>"
export AWS_SECRET_ACCESS_KEY="<Secret Access Key>"
export AWS_DEFAULT_REGION="ap-southeast-2" # I'm in Sydney! It's worth making this close...
export STREAM_NAME="skyline-dash-front"
/home/pi/dev/amazon-kinesis-video-streams-producer-sdk-cpp/kinesis_video_gstreamer_sample_app $STREAM_NAME
@cogwirrel
cogwirrel / download-kinesis-video-stream.sh
Last active March 8, 2020 06:41
Download a particular time range of a kinesis video stream as an mp4
#!/bin/bash
# Download a chunk of kinesis stream!
# Prerequisites: awscli, ffmpeg, jq
# Usage: ./download-kinesis-video-stream.sh --start "2020-03-08T13:53:00+11:00" --end "2020-03-08T13:54:00+11:00" --output output.mp4
# Change these to whatever you use...
STREAM_NAME="skyline-dash-front"
AWS_PROFILE="skyline"
AWS_REGION="ap-southeast-2"
@cogwirrel
cogwirrel / libcurl_builder.sh
Created December 20, 2016 01:58
Build curl and openssl for all android architectures
#!/bin/bash
USAGE=$'Usage:
./libcurl_builder <options>
Required:
-c <curl_directory> The top level curl directory
-s <openssl_directory> The top level openssl directory
-n <ndk_directory> The top level ndk directory
@cogwirrel
cogwirrel / .emoji_prompt
Last active July 13, 2017 10:39
Random emojis in your terminal prompt!
#### INSTRUCTIONS ####
#
# 1) Add the contents of this file to your .bash_profile in your home directory
# 2) Save .emojis in your home directory
# 3) Profit
#### EMOJI PROMPT ##########################################
# This picks a random emoji from your '.emojis' file!
ORIGINAL_IFS=$IFS
IFS=$'\n' read -d '' -r -a emojis < ~/.emojis
@cogwirrel
cogwirrel / airport_info.rb
Created June 2, 2016 15:02
A ruby script that uses nokogiri to scrape wikipedia for all the airport IATA codes, with airport names and locations too
require 'nokogiri'
require 'open-uri'
# Get all the airports from wikipedia!
def get_airport_info_from_wikipedia()
airport_info = []
"ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("").each do |letter|
doc = Nokogiri::HTML(open("https://en.wikipedia.org/wiki/List_of_airports_by_IATA_code:_#{letter}"))
iata_table = doc.xpath("//table")[0]
rows = iata_table.xpath("//tr")
@cogwirrel
cogwirrel / tugo_backup.js
Created June 1, 2015 00:14
TuGo SMS Backup
var backup = function(options) {
$.ajax({
url: "https://api-gb.tugoapp.com/users/me/history?from_version=0&page_size=" + options.numTexts + "&page_number=1&with_source=" + options.theirNumber + "," + options.myNumber + "&with_destination=" + options.theirNumber + "," + options.myNumber,
headers: {
"X-External-Transaction-Id": "blahblah123",
"Authorization": "Bearer " + options.token,
"X-User-Version": "1.2.0",
"X-Country-Code": "GB",
"X-User-Msisdn": options.myNumber,
"Accept-Language": "en-GB,en-US;q=0.8,en;q=0.6",
@cogwirrel
cogwirrel / monster.rb
Last active January 2, 2016 09:59
Check whether certain flavours of a product are in stock on monstersupplements.com, and email you if they are!
require "net/http"
require "uri"
require "net/smtp"
product = "C4 Extreme"
url = "http://monstersupplements.com/store/p/5548/1/Cellucor-C4-Extreme-60-servings.html"
flavours = ["Fruit Punch", "Orange", "Blue Raspberry", "Green Apple", "Watermelon"]
wantedFlavours = ["Orange", "Watermelon"]
emails = ["your@email.com", "another@email.com"]