Skip to content

Instantly share code, notes, and snippets.

@ukn
ukn / 99-install-facetime-camera.sh
Created Jul 3, 2020 — forked from Stono/99-install-facetime-camera.sh
Install the kernal module required for the facetimehd camera to work on Linux
View 99-install-facetime-camera.sh
#!/bin/bash
set -e
export CONFIG_MODULE_SIG=n
export CONFIG_MODULE_SIG_ALL=n
# For current kernel
export KERNELRELEASE=$(cat /proc/version | awk '{print $3}')
temp_dir=$(mktemp -d)
echo "Installing FacetimeHD camera for $KERNELRELEASE"
@ukn
ukn / dynhost-cf.sh
Created Jan 27, 2020
Update Cloudflare A record when your IP changes
View dynhost-cf.sh
#!/bin/bash
# Updates Cloudflare dns record
# when your home IP changes
# Put in in cron with desired frequency
# but don't abuse WTF service (they throttle anyway)
set -e
API_TOKEN=YOUR_API_TOKEN_HERE
@ukn
ukn / elasticseach_index_dump.sh
Created Feb 28, 2019
Dirty way of getting elasticsearch index data for debugging
View elasticseach_index_dump.sh
#!/bin/bash
set -e
# Don't use in PROD!
# Script params:
# ES_URL - https://your-elasticseach-url.local
# INDEX - your-index-name
ES_URL=$1
INDEX=$2
SUFFIX=0
@ukn
ukn / remove_servers_from_newrelic.js
Last active Oct 26, 2017
Remove old servers from NewRelic Server app
View remove_servers_from_newrelic.js
#!/usr/bin/env node
/*
Deletes servers from New Relic Server app that were last seen before cutoff date
*/
const https = require("https")
const cutoff = new Date("2017-10-15T00:00:00.001")
const filter = 'filter[reported]=false&sort[health_status]=false'
var promises = []
@ukn
ukn / ss.sh
Last active Oct 27, 2016
bash function that gives nicely formated services status from consul
View ss.sh
ss() {
if [[ -z ${2+x} ]]; then
ssh ${1} "curl -s localhost:8500/v1/catalog/services | \
jq -rc 'keys | .[]' | while read i; do curl -s localhost:8500/v1/health/service/\${i} | jq -r '.[] | .Checks[] | select(.CheckID != \"serfHealth\") | .ServiceName + \" \" + .CheckID + \" \" + .Status'; done | column -t -x"
else
ssh ${1} "curl -s localhost:8500/v1/health/service/${2} | jq -r '.[] | .Checks[] | select(.CheckID != \"serfHealth\") | .CheckID + \"\t\" + .Status + \"\t\t\" + .Output'"
fi
}
@ukn
ukn / awsls.sh
Last active Oct 27, 2016
bash function that formats `aws ec2 describe-instances` into something readable
View awsls.sh
awsls(){
if [ -z ${1+x} ]; then
temp=`aws ec2 describe-instances`
else
temp=`aws ec2 describe-instances --profile ${1}`
fi
# All tags version
# aws ec2 describe-instances | jq -r '.Reservations[].Instances[] | | select (.State.Name != "terminated") | .InstanceId + "\t" + .PrivateIpAddress + "\t" + .PublicIpAddress + "\t" + .InstanceType + "\t" + (reduce.Tags[] as $tag (""; . + $tag.Key + "=" + $tag.Value + " "))'
View keybase.md

Keybase proof

I hereby claim:

  • I am ukn on github.
  • I am ukn (https://keybase.io/ukn) on keybase.
  • I have a public key whose fingerprint is 53CB D2D1 9D82 BA8C 8D24 E51E 9B58 DE68 310F F0FE

To claim this, I am signing this object:

You can’t perform that action at this time.