Skip to content

Instantly share code, notes, and snippets.

View sevaine's full-sized avatar

Andrew Johnson sevaine

  • Octopus Energy P/L
  • Melbourne, AU
View GitHub Profile
@sonodar
sonodar / get_ssm_parameters.js
Last active April 3, 2024 06:24
Get secret parameters from Amazon EC2 Parameter Store
if (process.argv.length < 3) {
throw `Usage: ${process.argv[1]} path_prefix`
}
const PATH_PREFIX = process.argv[2]
const path = require('path')
const AWS = require('aws-sdk')
const ssm = new AWS.SSM()
function getParametersByPath(nextToken, callback) {
@myobie
myobie / request.rb
Last active November 12, 2018 05:15
Request / Response for easier Net::HTTP usage in ruby
require 'net/http'
require 'json'
require_relative 'response'
class Request
AlreadyComplete = Class.new(StandardError)
VERBS = {
head: Net::HTTP::Head,
get: Net::HTTP::Get,
@sevaine
sevaine / gist:5894324
Created June 30, 2013 08:12
Quick and dirty Python dictionary comprehension of os.listdir to build a dictionary of current dir and file names as keys, and provide their values as the "cleaned" file or dir names. Very handy when bulk renames of files containing spaces, or other non alphanum characters in their name are required.
#!/usr/bin/env python
""" load modules """
import os
import sys
""" What dir are we listing? """
target_dir = sys.argv[1]
""" Build dict """
@willurd
willurd / web-servers.md
Last active June 26, 2024 11:15
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@velppa
velppa / data_as_inserts.sql
Created December 30, 2012 08:45
This script exports data from tables as insert statements. Useful for exporting data from static dictionary tables. #oracle #sqlplus
set heading off
set linesize 1000
rem set pagesize 50000
set echo off
set serveroutput on
SET FEEDBACK OFF
SPOOL out.sql
DECLARE
cur SYS_REFCURSOR;