Skip to content

Instantly share code, notes, and snippets.

View amosshapira's full-sized avatar

Amos Shapira amosshapira

  • Sydney, Australia
View GitHub Profile
require 'gsl'
require 'time'
module Diskalerter
class ThresholdEstimator
attr_reader :timestamps, :signal, :threshold, :now
# timestamps - a list of timestamps in epoch milliseconds
# signal - a list of values for the provided timestamps
# threshold - the "exhaustion" threshold (e.g., 100 for a percentage signal)
development:
adapter: mysql2
encoding: utf8
database: my_database
username: root
roles:
- admin
- developer
- guest
password:
@philcryer
philcryer / coreid.sh
Last active April 19, 2017 07:00
Get the Amazon CoreOS AMI ID and URL
#!/bin/bash
build=alpha # define build ["stable", "beta", "alpha"]
disk=hvm # define disk backing ["pv", "hvm"]
if [ "x$1" = "x" ]; then
echo "Usage: $0 REGION"; exit 1
fi
#### deprecated
@denji
denji / golang-tls.md
Last active February 21, 2026 12:07 — forked from spikebike/client.go
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@kevinelliott
kevinelliott / osx-10.10-setup.md
Last active July 3, 2025 21:23
Mac OS X 10.10 Yosemite Setup

Mac OS X 10.10 Yosemite

Custom recipe to get OS X 10.10 Yosemite running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your own needs.

Install Software

@mackbrowne
mackbrowne / gist:e119c025ebfc517950f5
Created June 27, 2014 15:50
Split json into multiple files using jq
cat data.json | jq -c -M '.data[]' | \
while read line; do echo $line > parts/$(date +%s%N).json; done
@staltz
staltz / introrx.md
Last active March 3, 2026 15:51
The introduction to Reactive Programming you've been missing

コマンド

set policy route PPPOE-IN rule 10 destination address 0.0.0.0/0
set policy route PPPOE-IN rule 10 protocol tcp
set policy route PPPOE-IN rule 10 tcp flags 'SYN,!ACK,!FIN,!RST'
set policy route PPPOE-IN rule 10 set tcp-mss 1414
set interface ethernet eth0 policy route PPPOE-IN

/sbin/iptables -L -n -t mangle

@danrigsby
danrigsby / packer-ami-id
Last active December 14, 2023 15:07
Get AMI ID from a packer build
packer build packer.json 2>&1 | sudo tee output.txt
tail -2 output.txt | head -2 | awk 'match($0, /ami-.*/) { print substr($0, RSTART, RLENGTH) }' > sudo ami.txt