Skip to content

Instantly share code, notes, and snippets.

View devnulled's full-sized avatar

Brandon Harper devnulled

View GitHub Profile
@devnulled
devnulled / fix.sh
Created March 21, 2019 20:35
Deleting Stuck or Hung Kubernetes CRD's and CR's
#
# How to patch and delete CustomResourceDefinitions and CustomResources in Kubernetes
#
#
# Just copied and pasted from this solution in a kubernetes bug report:
#
# https://github.com/kubernetes/kubernetes/issues/60538
#
# remove the CRD finalizer blocking on custom resource cleanup
@devnulled
devnulled / chrony.conf
Created November 19, 2018 19:04
Default Chrony Config for Debian on AWS
# Welcome to the chrony configuration file. See chrony.conf(5) for more
# information about usuable directives.
#
# Amazon AWS NTP Server
#
server 169.254.169.123 prefer iburst
# This directive specify the location of the file containing ID/key pairs for
# NTP authentication.
@devnulled
devnulled / boot.sh
Created October 2, 2018 22:19
Simple shell script to install crony on boot in the Kubernetes version of Debian to use AWS time servers. Other keywords: time, sync, ntp, ntpd
#!/usr/bin/env bash
export DEBIAN_FRONTEND=noninteractive
apt-get -q -y install chrony --no-install-recommends
sed -i 's/pool 2.debian.pool.ntp.org iburst/server 169.254.169.123 prefer iburst/g' /etc/chrony/chrony.conf
systemctl restart chrony
@devnulled
devnulled / gist:d1993a45bc87643a03a76c6dcd51d125
Last active September 18, 2018 20:43
Run A Command Against a Collection of Kubernetes Resources
# An example of running a command against each persistantvolume of a given storage class in CoolBrosNetes
# Grab the JSON to parse from k8s
kubectl get pv -o json > pv.json
# Parse the JSON with jq and run that shit
jq -r '.items[] | select(.spec.storageClassName=="my-storage-class") | [.metadata.name] | @tsv' pv.json |
while IFS=$'\t' read -r name; do
echo The name is $name
done
#!/usr/bin/env python
# coding=UTF-8
import math, subprocess
p = subprocess.Popen(["ioreg", "-rc", "AppleSmartBattery"], stdout=subprocess.PIPE)
output = p.communicate()[0]
o_max = [l for l in output.splitlines() if 'MaxCapacity' in l][0]
o_cur = [l for l in output.splitlines() if 'CurrentCapacity' in l][0]
@devnulled
devnulled / 0_reuse_code.js
Last active August 29, 2015 14:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

Keybase proof

I hereby claim:

  • I am devnulled on github.
  • I am devnulled (https://keybase.io/devnulled) on keybase.
  • I have a public key whose fingerprint is 8B20 AB7F 1079 A02E 80BE 487D 2874 2656 D1B0 C961

To claim this, I am signing this object:

@devnulled
devnulled / project_documentation_methods.md
Created November 25, 2013 18:01
Ways I've ran across to implement documentation for a project, particularly in GitHub.

GitHub Project Documentation Methods

Just a quick guide on methods I've seen to document GitHub projects. This is not a complete list by any means, just things I've ran across and bookmarked.

More Common

  • GitHub Wiki's
  • GitHub Sites
  • A directory of markdown or AsciiDoc files
  • Sphinx generated documentation
@devnulled
devnulled / gist:5716661
Created June 5, 2013 19:42
Add An External Configuration File to a Grails Project

How To Create An External Configuration File in Grails

Note, this information is taken from user Big Ed at StackOverflow. Thanks Ed!

Ed's Answer

Create a properties file myExternalProperties.groovy and put it on your classpath (such as the $TOMCAT_HOME/lib directory).

Create a configuration file grails-app/conf/MyConfig.groovy to use the external configuration values (if needed). You will not be able to use the properties defined in myExternalProperties.groovy within grails-app/conf/Config.groovy.

@devnulled
devnulled / gist:4946216
Created February 13, 2013 17:13
I can never quite remember the form for GitHub Enteprise URLs for published pages. Here is how the URL's are accessed.
GitHub Pages URLs on an Enterprise instance take the form of http(s)://[hostname]/pages/[user]/[repo]