Skip to content

Instantly share code, notes, and snippets.

View geowa4's full-sized avatar
🏠
Working from home

George Adams geowa4

🏠
Working from home
View GitHub Profile
@geowa4
geowa4 / digitalocean.sh
Last active March 12, 2019 09:30
Dynamic inventory for DigitalOcean grouping by tag.
#!/usr/bin/env bash
set \
-o nounset \
-o pipefail \
-o errexit
tags=$(doctl compute tag list --output json | jq -r '.[].name')
aggregate=$(jq -n '{ "_meta": { "hostvars": { } } }')
#!/usr/bin/env bash
set \
-o nounset \
-o pipefail \
-o errexit \
-o verbose \
-o xtrace
# Create users table and apply indices.
class CreateUsers < ActiveRecord::Migration[5.0]
def change
create_table :users, force: true, id: false, primary_key: 'id' do |t|
t.binary :id, default: 'uuid_v4()'
t.string :login, null: false
t.string :email, null: false
end
add_index :users, :login, unique: true
add_index :users, :email, unique: true
@geowa4
geowa4 / input
Created September 16, 2016 17:36
Find the word with the most repeated characters.
O Romeo, Romeo, wherefore art thou Romeo?
Some people feel the rain, while others just get wet.
ffff ----- '''''' D'd-d'-dd'-dd-' d'd-d'-dd'-dd-'
- name: create load balancer
ec2_elb_lb:
name: '{{ application }}-{{ item.name }}-elb'
region: '{{ region }}'
connection_draining_timeout: 60
cross_az_load_balancing: yes
health_check:
ping_protocol: http
ping_port: 80
ping_path: '{{ item.elb_ping_path|default("/") }}'
- name: create load balancer
ec2_elb_lb:
name: '{{ application }}-{{ item.name }}-elb'
region: '{{ region }}'
connection_draining_timeout: 60
cross_az_load_balancing: yes
health_check:
ping_protocol: http
ping_port: 80
ping_path: '{{ item.elb_ping_path|default("/") }}'
bluetooth.lookup_name('10:53:2F:CA:FC:58')
@geowa4
geowa4 / discover.py
Created March 14, 2016 04:05
Discover Bluetooth addresses.
import bluetooth
nearby_devices = bluetooth.discover_devices(
duration=8, lookup_names=True, flush_cache=True, lookup_class=False
)
for addr, name in nearby_devices:
print("%s - %s" % (addr, name))
@geowa4
geowa4 / Dockerfile
Created March 14, 2016 03:28
rpi-blue-python
FROM resin/rpi-raspbian:jessie
RUN apt-get update && \
apt-get install -y \
build-essential \
bluez bluez-tools \
python-dev python-pip \
libglib2.0-dev libboost-python-dev libboost-thread-dev libbluetooth-dev && \
pip install pybluez gattlib
Verifying that +geowa4 is my blockchain ID. https://onename.com/geowa4