Skip to content

Instantly share code, notes, and snippets.

@cfg
cfg / zen34.yaml
Last active July 25, 2024 19:03 — forked from computergreek/zen34.yaml
Generic entity blueprint tutorial for Zen34
blueprint:
name: Zooz ZEN34 Blueprint for generic entities. Does not support brightness.
description: Control a device with single-tap and double-tap
# reference: https://gist.github.com/flyingsubs/35246fa2935f105f133385c6cf41f6fa
# reference: https://gist.github.com/computergreek/847ad5194168cf3f26a0c908acc9431c
# reference: https://youtu.be/L-bcabdaMxE
# reference: https://chat.openai.com/share/299064bf-56bf-4bdb-a12b-3b474d8fec65
domain: automation
author: cfg
@cfg
cfg / slack_leave_bd_channels.py
Created July 15, 2022 17:39 — forked from krets/slack_leave_bd_channels.py
Quick script to leave a bunch of slack channels with the "bd-" prefix.
#!/usr/bin/env python
import argparse
import requests
import logging
LOG = logging.getLogger("slack_leaver")
class JSONRest(object):
def __init__(self, base_url):
#!/usr/bin/env bash
# Take a snapshot of user and system application icons before the Big Sur aesthetic is applied
function sync() {
FROM="$1"
TO="$2"
mkdir -p "$TO"
@cfg
cfg / billboard.js
Last active July 10, 2021 20:19
Anti-Adblock Removal Scripts
javascript:(function(){
document.querySelector('.article__body.article__overlay') && document.querySelector('.article__body.article__overlay').classList.remove('article__overlay');
document.getElementById('checkout-container') && document.getElementById('checkout-container').remove();
document.querySelector('div.piano-article-overlay') && document.querySelector('div.piano-article-overlay').remove();
})();
@cfg
cfg / dns_lookup.py
Created May 30, 2019 19:37
Use python for quick dns lookups when other tools (dig, host, nslookup) aren't available
import socket
list( map( lambda x: x[4][0], socket.getaddrinfo('example.com.', 80, 0, socket.SOCK_STREAM) ))
@cfg
cfg / .bashrc
Created May 6, 2019 14:44
Storing sensitive environment variables the keychain, selectively setting them on a per-application basis.
source ~/bash.includes/keychain-environment-variables.sh
function aws-vault() {
/usr/local/bin/aws-vault-wrapper "$@"
}
# example wrapper
## function cloudns-api() {
## (
## export CLOUDNS_API_ID=$(keychain-environment-variable CLOUDNS_API_ID)
@cfg
cfg / ga_spreadsheet_onedit_timetimestamp.js
Created April 12, 2017 17:17
Google Sheets: Add a "last modified" timestamp to a row when a cell in a specific column is changed. Quick, hacky code, per usual.
function onEdit( evt ) {
var ss = SpreadsheetApp.getActiveSheet();
var sheet_name = 'Bug List';
if ( sheet_name !== ss.getName() ) {
return;
}
var status_col = 8; // column number that contains the status type
var lastmod_col = 10; // column number where the timestamp should go
@cfg
cfg / gist:4585f041cd069d3f2639e53fc33ae281
Created April 4, 2017 18:17
Extracting 2FA seeds from Authy
Open chrome://extensions, debug Authy main.html
Set a breakpoint in Authy app.js in this function:
d.prototype.getOtp = function() {
return this.isEncrypted() ? "------" : this.otpGenerator.getOtp(this.decryptedSeed, this.digits)
}
Can use a conditional breakpoint, where this.getName() == 'your.account.display.name'
console.log( "otpauth://totp/%s:%s?secret=%s&issuer=%s", encodeURIComponent( this.getAccountName() ), encodeURIComponent( this.getName() ), encodeURIComponent(this.decryptedSeed), this.getAccountName() );
@cfg
cfg / compile_futurerestore.sh
Created January 1, 2017 19:39
Compile futurerestore from @tihmstar on OS X
brew install openssl
git clone --recursive [email protected]:tihmstar/futurerestore.git
cd futurerestore/
export PKG_CONFIG_PATH=/usr/local/share/pkgconfig:/usr/local/lib/pkgconfig:$(brew --prefix openssl)/lib/pkgconfig
./autogen.sh
make
./futurerestore/futurerestore
@cfg
cfg / WWDC Line hax
Created November 9, 2016 15:38 — forked from b3ll/WWDC Line hax
// June 11, 2012
// https://twitter.com/b3ll/status/212169466665111552
-(BOOL)isBlocked
{
return false;
}
-(int)epicWWDCLineHacks
{