Skip to content

Instantly share code, notes, and snippets.

Andrew Beresford beezly

Block or report user

Report or block beezly

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@beezly
beezly / rotate-passwords.sh
Created Sep 9, 2019
Use kpasswd to rotate through a number of passwords between your old and new passwords
View rotate-passwords.sh
#!/usr/bin/env bash
CYCLE=24
declare -a PASSWORDS
let last_cycle=CYCLE+1
PASSWORDS[0]=$1
PASSWORDS[${last_cycle}]=$2
for i in $(seq ${last_cycle}); do
echo $i
@beezly
beezly / main.py
Created Jan 13, 2019
ESP32 Hardware Interrupts in micropython
View main.py
import machine
import sys
import utime
# Error buffer for inside ISRs
import micropython
micropython.alloc_emergency_exception_buf(100)
class Run():
def __init__(self):
@beezly
beezly / azure-token.sh
Last active Jul 19, 2018
get a vault token using azure
View azure-token.sh
#!/bin/bash -e
api_version="2018-02-01"
resource="https://<your resource URL>"
instance_data=$(curl -s -H 'Metadata: true' "http://169.254.169.254/metadata/instance?api-version=${api_version}")
offer_data=$(curl -s -H 'Metadata: true' "http://169.254.169.254/metadata/identity/oauth2/token?api-version=${api_version}&resource=${resource}")
rg=$(jq -r .compute.resourceGroupName <<< $instance_data)
type=vmss
name=$(jq -er .compute.vmScaleSetName <<< $instance_data)
@beezly
beezly / gist:52567aa8210fa16eae74a556ef14f0da
Created Apr 19, 2018
Delete One Password Items Duplicated by Title
View gist:52567aa8210fa16eae74a556ef14f0da
op list items | jq -r 'group_by(.overview.title) | .[] | select(length > 1) | min_by(.updatedAt) | .uuid' | xargs -n 1 op item delete
View keybase.md

Keybase proof

I hereby claim:

  • I am beezly on github.
  • I am beezly (https://keybase.io/beezly) on keybase.
  • I have a public key ASBqxtgg-zWLBnFoVdcBozWvYRuZfD40OmACI9-rUvPjZAo

To claim this, I am signing this object:

@beezly
beezly / gist:3137c7db87c08931f04c58543dcca8c7
Last active Feb 15, 2017
Make jenkins use White on Black text in the console. Use with the Chrome Stylish extension to apply to your instance of Jenkins. -- https://chrome.google.com/webstore/detail/stylish-custom-themes-for/fjnbnpbmkenffdnngjfgmeleoegfcffe?hl=en
View gist:3137c7db87c08931f04c58543dcca8c7
pre.console-output {
font: "Lucida Console", Monaco, monospace;
font-size: 11pt;
color: white;
background-color: black;
padding: 0.5em;
}
span.timestamp {
color: #888;
@beezly
beezly / screenaver.pp
Created Jan 13, 2016
Puppet augeas to disable screensaver by default in RH6
View screenaver.pp
$enabled = false
augeas{'disable_default_screensaver_lock':
lens => 'Xml.lns',
incl => '/etc/gconf/gconf.xml.defaults/%gconf-tree.xml',
context => '/files/etc/gconf/gconf.xml.defaults/%gconf-tree.xml/gconf/dir[#attribute[name="schemas"]]/dir[#attribute[name="apps"]]/dir[#attribute[name="gnome-screensaver"]]/dir[#attribute[name="lock_enabled"]]/local_schema/default',
changes => "set #attribute/value ${enabled}",
}
@beezly
beezly / gist:84c6300982d9ec0cf53d
Last active Aug 29, 2015
Create Calendar Events when I get parking receipt messages. Depends on receiving an email in the right format from the parking payment provider.
View gist:84c6300982d9ec0cf53d
function processParkingMessages() {
// get all unread messages labelled as Parking
var parkingThreads = GmailApp.getUserLabelByName('Parking').getThreads();
var parkingThreadMessages = parkingThreads.map(function(thread) { return thread.getMessages(); });
var parkingMessages = [];
var parkingMessages = parkingMessages.concat.apply(parkingMessages, parkingThreadMessages);
var unreadParkingMessages = parkingMessages.filter(function(message) { return message.isUnread(); });
// Map through all the unread parking messages and search for a date/time in the appropriate format.
@beezly
beezly / gist:9b2de3749d687fdbff3f
Last active Mar 14, 2019
Log Nest temperatures into a Google Spreadsheet. Update the username and password values and create a resource trigger to call "getData" at regular intervals.
View gist:9b2de3749d687fdbff3f
function performLogin(email, password) {
var payload = {
"username" : email,
"password" : password
};
var options = {
"method" : "post",
"payload" : payload
};
@beezly
beezly / gist:267b80557900b865bc92
Last active Apr 2, 2019
Find the SSL/TLS version clients are negotiate with your SSL server. Adapt the "src port 443" part as per your requirements. Uses tshark from https://www.wireshark.org
View gist:267b80557900b865bc92
tshark -f 'src port 443 and ether[0x42]=0x16 and ether[0x47]=0x02' -T fields -e ip.dst_host -e ssl.handshake.version
You can’t perform that action at this time.