Skip to content

Instantly share code, notes, and snippets.

View samcrang's full-sized avatar
🤖
computing

Sam Crang samcrang

🤖
computing
View GitHub Profile
@samcrang
samcrang / lol.yaml
Created June 15, 2023 19:53
Meaco Fan Pronto Codes
# https://www.meaco.com/products/meaco-fan-1056-remote-control
button:
- platform: template
name: "Meaco On/Off"
on_press:
remote_transmitter.transmit_pronto:
data: "0000 006D 0022 0000 0161 00AE 0015 0017 0015 0017 0015 0017 0015 0017 0015 0017 0015 0017 0015 0017 0015 0042 0015 0042 0015 0042 0015 0042 0015 0042 0015 0042 0015 0042 0015 0042 0015 0017 0015 0017 0015 0042 0015 0017 0015 0017 0015 0042 0015 0017 0015 0017 0015 0042 0015 0042 0015 0017 0015 0042 0015 0042 0015 0017 0015 0042 0015 0042 0015 0017 0015 06C3"
- platform: template
name: "Meaco Up/Down"
import subprocess
import runpy
import sys
import tempfile
import boto3
import argparse
import os
from urllib.parse import urlparse
from importlib import reload
from setuptools.command import easy_install
@samcrang
samcrang / gist:4192e04ff39c9618cbc79cc99e76152f
Created April 5, 2017 10:15
Multiple Password Stores (`pass`) with ZSH auto-completion
# Place in `~/.non-default-password-store/.load.zsh` and source in your `.zshrc`
_tmp_pass_dir=${0:a:h}
_tmp_pass_name=$(echo "${0:a:h:t}" | sed 's/^\.*//')
eval "${_tmp_pass_name}() { \
PASSWORD_STORE_DIR=${_tmp_pass_dir} pass \$@ \
}"
if whence _pass &> /dev/null; then
git ls-tree -r master --name-only | rev | cut -d . -f 1 | rev | sort | uniq -c | sort -n

Keybase proof

I hereby claim:

  • I am samcrang on github.
  • I am samcrang (https://keybase.io/samcrang) on keybase.
  • I have a public key whose fingerprint is B915 90AE A3A6 B81B CAE9 9ADC 1F07 3150 57BC 3A55

To claim this, I am signing this object:

tcpdump -i any -w foo.pcap -n "host $(dig +short example.com)"
@samcrang
samcrang / aws_elasticsearch_client.py
Last active January 14, 2016 05:39
Connect to an AWS hosted Elasticsearch cluster (works in Lambda too).
# $ pip freeze
# elasticsearch==1.9.0
# requests-aws4auth==0.7
# requests==2.7.0
# certifi==2015.11.20.1
from elasticsearch import Elasticsearch
from elasticsearch.connection import RequestsHttpConnection
from requests_aws4auth import AWS4Auth
import certifi
@samcrang
samcrang / gist:dc902a81d064ffd3c1a0
Last active December 15, 2015 11:40
Docker: delete untagged images
docker rmi $(docker images -q -f dangling=true)
@samcrang
samcrang / gist:6d24040bfe2084d68d5a
Last active August 29, 2015 14:27
Find subset of Instance information across all AWS regions
aws ec2 describe-regions --output text | cut -f 3 | xargs -L 1 aws ec2 describe-instances --region us-west-1 --query 'Reservations[].Instances[].{Name:Tags[?Key==`Name`].Value[]|[0],State:State.Name,Placement:Placement.AvailabilityZone}' --region
@samcrang
samcrang / gist:a2959d7ebae7632d6a5a
Last active August 29, 2015 14:17
Remove all Vagrant boxes on machine
vagrant box list | sed -e 's/)//' | awk '$3 {print $1 " --box-version " $3 } !$3 {print $1}' | xargs -L 1 vagrant box remove -f