Skip to content

Instantly share code, notes, and snippets.

View ev0rtex's full-sized avatar

David Warkentin ev0rtex

View GitHub Profile
@ev0rtex
ev0rtex / salt-level-sensor.yml
Created April 20, 2023 18:06
ESPHome salt level sensor config
esphome:
name: salt-level-sensor
esp8266:
board: d1_mini
# Enable logging
logger:
# Enable Home Assistant API
@ev0rtex
ev0rtex / instance-types.sh
Created July 23, 2019 23:35 — forked from trestletech/instance-types.sh
Get all EC2 Instance Types in All Availability Zones
#!/bin/bash
echo "Getting list of Availability Zones"
all_regions=$(aws ec2 describe-regions --output text --query 'Regions[*].[RegionName]' | sort)
all_az=()
while read -r region; do
az_per_region=$(aws ec2 describe-availability-zones --region $region --query 'AvailabilityZones[*].[ZoneName]' --output text | sort)
while read -r az; do
@ev0rtex
ev0rtex / rpn.py
Created May 6, 2018 21:20
Python RPN calculator implementation
#!/usr/bin/env python3
import sys
import operator
from decimal import Decimal
def main():
ops = {
"+": operator.add,
"-": operator.sub,
@ev0rtex
ev0rtex / water_bodies.py
Created April 27, 2018 07:46
Sorted sizes of bodies of water
#!/usr/bin/env python3
DIAGONAL_WATER = True
def dfs_from(arr, i, j):
size = 0
if i >= 0 and j >= 0 and i < len(arr) and j < len(arr) and arr[i][j] == 0:
arr[i][j] = -1 # Mark visited
size += 1
size += dfs_from(arr, i, j + 1) # right
size += dfs_from(arr, i + 1, j) # down

Keybase proof

I hereby claim:

  • I am ev0rtex on github.
  • I am darkwing (https://keybase.io/darkwing) on keybase.
  • I have a public key whose fingerprint is 7EEB 9106 942E CD46 0C5C 15C0 66BA AD06 E6A9 850A

To claim this, I am signing this object:

@ev0rtex
ev0rtex / pillar_elastic.sls
Last active August 29, 2015 14:20
ElasticSearch via Salt
esversions:
1.5.1:
zip: "https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.5.1.zip"
tar: "https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.5.1.tar.gz"
deb: "https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.5.1.deb"
rpm: "https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.5.1.noarch.rpm"
apt: "http://packages.elasticsearch.org/elasticsearch/1.5/debian"
yum: "http://packages.elasticsearch.org/elasticsearch/1.5/centos"
plugins:
elasticsearch/elasticsearch-analysis-icu: 2.5.0
@ev0rtex
ev0rtex / raet.sls
Created March 11, 2015 19:34
SaltStack
# Get version information
{% set versions = salt['pillar.get']('versions', {
"libsodium": "1.0.2"
}, True) %}
# Fetch libsodium tar and hash
{% do salt['cp.get_url'](
"https://download.libsodium.org/libsodium/releases/libsodium-" ~ versions.libsodium ~ ".tar.gz",
"/tmp/libsodium.tar.gz"
) %}
@ev0rtex
ev0rtex / DDM_OAUTH.md
Last active January 21, 2016 16:42
DDM OAuth2 API

DDM OAuth2 API

##OAuth2 Flow

Definitions:

Resource Owner: A User with access to a desired resource Client: Entity (3rd party) desiring access to a resource held by the Resource Owner Authorization Server: OAuth2 API server capable of granting access to resources Resource Server: The server with the desired resource(s) for which access is desired

@ev0rtex
ev0rtex / vagrant-cd.zsh
Created July 28, 2014 14:32
Change to directory of vagrant-managed VM
function vagrant-cd() {
VMS=()
OLD=$IFS
IFS=$'\r\n'
for line in $(vagrant global-status | egrep "^[a-z0-9]{7}\s" -); do
VMS+=($line)
done
IFS=$OLD
if [[ -z "$1" ]]; then
@ev0rtex
ev0rtex / fabfile.py
Last active August 29, 2015 14:04
Fabric access control
from fabric.api import env, run, sudo, prompt, hide, warn_only, quiet
from fabric.contrib import files
from getpass import getpass
import os
import re
def login(user=None, passwd=None):
uname = user if user is not None else prompt("Remote username: ", default=env.user)
pword = passwd if passwd is not None else getpass("Remote password: ")