Skip to content

Instantly share code, notes, and snippets.

View danhigham's full-sized avatar

Dan Higham danhigham

View GitHub Profile
@danhigham
danhigham / festool.scad
Last active January 22, 2023 16:06
Festool OpenSCAD
/*
Model: Basic cone hose converter
Author: Dan Higham
*/
$fa = 1;
$fs = 0.4;
//PARAMS
cone_length = 35;
@danhigham
danhigham / gist:d2a6cd7acd7e72aff34d1039699762e3
Created March 4, 2022 18:14
Show docker container resource usage..
docker ps -q | xargs docker stats --no-stream --format "table {{.Name}}\t{{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}" | sort -k 4 -h
@danhigham
danhigham / gist:12d3cdf79dd3b1b1966698a69b77c770
Last active April 15, 2020 13:45
Dan's handy kubectl one liners
# Remove all replicasets with 0 pods
for i in $(kubectl get rs -o json | jq -r '.items[] | select(.status.replicas==0) | .metadata.name'); do kubectl delete rs/$i; done
# Remove all resources with a certain label set
for i in $(kubectl api-resources -o name); do for x in $(kubectl get $i -l "kapp.k14s.io/app=1586922989415912400" -o name); do kubectl delete $x; done; done
#!/bin/bash
s3cmd ls -r $1/ | while read -r line;
do
createDate=`echo $line|awk {'print $1" "$2'}`
createDate=`date -d"$createDate" +%s`
olderThan=`date --date "7 days ago" +%s`
if [[ $createDate -lt $olderThan ]]
then
fileName=`echo $line|awk {'print $4'}`
@danhigham
danhigham / main.go
Last active December 13, 2018 00:27
Hall of shame, cf memory consumption
package main
import (
"bufio"
"fmt"
"os"
"sort"
"strings"
"syscall"
@danhigham
danhigham / cf_dump.py
Created June 25, 2018 04:37
Dump CF Meta
#!/usr/bin/python
import json, subprocess
def cf_curl_json(cmd):
return json.loads(subprocess.Popen(("cf curl %s | jq '.resources[].entity' | jq --slurp '.'" % cmd),
stdout=subprocess.PIPE, shell=True).communicate()[0])
ORGS_SPACEURLS = [ (str(org['name']), str(org['spaces_url'])) for org in cf_curl_json("/v2/organizations") ]
for org, spaces_url in ORGS_SPACEURLS:
ORG_SPACE_APPURLS = [ (org, str(space['name']), str(space['apps_url'])) for space in cf_curl_json(spaces_url) ]
for org, space, app_url in ORG_SPACE_APPURLS:
@danhigham
danhigham / uap-ac-lite-openwrt.txt
Created January 27, 2018 04:47 — forked from lg/uap-ac-lite-openwrt.txt
making the ubnt wifi awesome (uap ac lite) w/ openwrt
making the ubnt wifi awesome (uap ac lite) w/ lede (openwrt)
the reasons you would do this:
- you get 802.11r
- you get better roaming
- you get access to some new 5ghz channels
I AM NOT TO BE HELD RESPONSIBLE FOR ANYTHING IN HERE. DO AT YOUR OWN RISK. THANK YOU AND HAVE A LOVELY DAY.
** note that though we're using Lede, it's essentially openwrt minus the drama
@danhigham
danhigham / xmas_leds.ino
Created December 23, 2017 04:45
xmas_leds.ino
#include <bitswap.h>
#include <chipsets.h>
#include <color.h>
#include <colorpalettes.h>
#include <colorutils.h>
#include <controller.h>
#include <cpp_compat.h>
#include <dmx.h>
#include <FastLED.h>
#include <fastled_config.h>
@danhigham
danhigham / response.json
Created November 13, 2017 00:05
Response from GMusic
{
"response": {
"card": {
"image": {
"largeImageUrl": "https://lh3.googleusercontent.com/53cYhGcuBl6tJh4NAsrkxHW2dYReUv27bwrA1nb_KNCrgIKeGjhfl-NmUzsu6mJGoyg1UBuvpDM",
"smallImageUrl": "https://lh3.googleusercontent.com/53cYhGcuBl6tJh4NAsrkxHW2dYReUv27bwrA1nb_KNCrgIKeGjhfl-NmUzsu6mJGoyg1UBuvpDM"
},
"text": "",
"title": "Playing top tracks by Radiohead",
"type": "Standard"
@danhigham
danhigham / index.md
Created September 28, 2017 14:29
Pushing with multiple buildpacks

Manifest looks like this;

---
name: ssas
memory: 256MB
instances: 1

If I want to push the app with multiple buildpacks, I do this;