Skip to content

Instantly share code, notes, and snippets.

View roblogic's full-sized avatar
💭
probably playing code golf

Rob Papesch roblogic

💭
probably playing code golf
  • Auckland, NZL
  • 12:17 (UTC +12:00)
View GitHub Profile
@transkatgirl
transkatgirl / encodetwitter.sh
Last active October 29, 2022 11:33
Encode a video for uploading to Twitter using FFMPEG and FDKAAC
#!/bin/bash
# https://developer.twitter.com/en/docs/twitter-api/v1/media/upload-media/uploading-media/media-best-practices
# - h.264 high profile
# - 60fps or less
# - aac-lc, he-aac not supported
# - 16:9 recommended
# - 512mb maximum
# - shorter than 140s
# - 1:1 pixel aspect ratio
# - yuv 4:2:0
@thoughtfulbloke
thoughtfulbloke / honest_rents_dec19.R
Created December 9, 2019 05:57
rent change in NZ
library(readr)
geo_mean <- read_csv("https://www.mbie.govt.nz/assets/Data-Files/Building-and-construction/Tenancy-and-housing/Rental-bond-data/Territorial-Authority/ta-geometric-mean.csv",
col_types = cols(
.default = col_double(),
Month = col_date(format = "")
))
library(dplyr)
library(ggplot2)
geo_mean %>% filter(Month >= as.Date("2009-01-01")) %>%
mutate(govt = c(rep("National", 105), rep("Labour",25))) %>%
# roll 2d6+3
function roll {
local match total
local -a rolls
if ! [[ "$1" =~ '([0-9]+)d([0-9]+)(\+[0-9]+)?' ]]; then
echo "usage: roll 2d6+3" 1>&2
return 1
fi
@dajare
dajare / time2base36.sh
Last active January 3, 2021 18:25
Shell script to convert unix timestamp to base36 (alphanumeric, lowercase)
#!/bin/bash
# takes unix timestamp and converts to base36
# ht: https://en.wikipedia.org/wiki/Base36#bash_implementation
value=$(date +%s)
result=""
base36="0123456789abcdefghijklmnopqrstuvwxyz"
while true; do
result=${base36:((value%36)):1}${result}
if [ $((value=${value}/36)) -eq 0 ]; then
@eashish93
eashish93 / bash scripting cheatsheet.md
Created August 23, 2017 14:09
Bash Scripting Cheatsheet
@roblogic
roblogic / Compare distributions with Gnuplot.md
Last active May 26, 2020 03:22
How to get response time distributions from Jmeter data, and plot the data to compare performance.

Comparing Response Distributions with Gnuplot

Bash script to get Response data

Analyse Jmeter CSV output using jstats2. The response values are in tmp files. Get frequency of response times into .dat files, using uniq and awk per below...

$ uniq -c /tmp/jstats2.1hASD | awk '{print $2, $1}' | sort -n > FPE10-50k-24May-freq.dat
$ uniq -c /tmp/jstats2.lJAVX | awk '{print $2, $1}' | sort -n > FPE11a-GetJourneys-freq.dat
$ uniq -c /tmp/jstats2.lEV2M | awk '{print $2, $1}' | sort -n &gt; FPE11b-JourneyKnown-freq.dat
@roblogic
roblogic / jstats2
Last active July 20, 2021 09:11
jstats2 - Parse Jmeter output (csv), compute statistics about the test execution and response times.
#!/bin/bash
# Parse jmeter output and get various stats
# Hat-tip to 'stig', https://git.io/vFmeI
set -e # Exit immediately on error
# set -x # Debug
usage="jstats2 <jmeter-csv-output-file>"
[ $1 ] || { echo "$usage" ; exit 1 ; }
JFILE=$1
# Show timestamp info
@jgrahamc
jgrahamc / airwolf.bas
Created May 9, 2017 18:00
AppleSoft BASIC program used in Airwolf S02E03 "Moffett's Ghost"
1 PP=2
10 HOME
12 PRINT
20 A$ = "0123456789ABCDEF"
30 FOR I = 1 TO 19
31 IF I = 9 THEN GOSUB 1000
40 L$ = ""
45 FOR J = 1 TO 9
50 L1 = INT ( RND (1) * 15 ) + 1: L2 = INT ( RND (1) * 15 ) + 1
60 L$ = L$ + MID$ (A$,L1,1) + MID$(A$,L2,1) + ": "
@roblogic
roblogic / vim on windows.md
Last active July 19, 2017 01:02
Notes to self, some common vim use cases
@KarlMrax
KarlMrax / Killing Time's Sprint.md
Last active December 24, 2020 05:24
Killing Time's Sprint

The warship looked about its internal systems. All was ready; any further delay would constitute prevarication. It turned itself about, facing back the way it had come. It powered up its engines slowly to accelerate gradually, sleekly away into the void. As it moved, it left the skein of space behind it seeded with mines and hyperspace-capable missiles. They might only remove a ship or two even if they were lucky, but they would slow the rest down. It ramped its speed up, to significant engine degradation in 128 hours, then 64, then 32. It held there. To go any further would be to risk immediate and catastrophic disablement.

It sped on through the dark hours of distance that to mere light were decades, glorying in its triumphant, sacrificial swiftness, radiant in its martial righteousness.