Skip to content

Instantly share code, notes, and snippets.

View tedb's full-sized avatar

Ted Behling tedb

View GitHub Profile
@tenderlove
tenderlove / z-wave-uart.md
Created February 4, 2018 00:41
Aeotec Z-Wave Z-Stick Gen 5 UART protocol

Z-Stick Serial API

The Z-Stick does bi-directional communication over a UART. The connection speed is 115200, '8N1'. There are "requests" and "responses". The client software can make requests to the Z-Stick, and it will send responses. But it seems the Z-Stick can make requests of the client software too. I have yet to figure out the requests the Z-Stick sends to the client software.

Packets

@enricofoltran
enricofoltran / main.go
Last active August 21, 2024 04:40
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@bearfrieze
bearfrieze / comprehensions.md
Last active December 23, 2023 22:49
Comprehensions in Python the Jedi way

Comprehensions in Python the Jedi way

by Bjørn Friese

Beautiful is better than ugly. Explicit is better than implicit.

-- The Zen of Python

I frequently deal with collections of things in the programs I write. Collections of droids, jedis, planets, lightsabers, starfighters, etc. When programming in Python, these collections of things are usually represented as lists, sets and dictionaries. Oftentimes, what I want to do with collections is to transform them in various ways. Comprehensions is a powerful syntax for doing just that. I use them extensively, and it's one of the things that keep me coming back to Python. Let me show you a few examples of the incredible usefulness of comprehensions.

@mpasternacki
mpasternacki / freebsd_on_mbp.md
Created January 23, 2015 17:12
FreeBSD on a MacBook Pro

FreeBSD on a MacBook Pro

Since 2008 or 2009 I work on Apple hardware and OS: back then I grew tired of Linux desktop (which is going to be MASSIVE NEXT YEAR, at least since 2001), and switched to something that Just Works. Six years later, it less and less Just Works, started turning into spyware and nagware, and doesn't need much less maintenance than Linux desktop — at least for my work, which is system administration and software development, probably it is better for the mythical End User person. Work needed to get software I need running is not less obscure than work I'd need to do on Linux or othe Unix-like system. I am finding myself turning away from GUI programs that I used to appreciate, and most of the time I use OSX to just run a terminal, Firefox, and Emacs. GUI that used to be nice and unintrusive, got annoying. Either I came full circle in the last 15 years of my computer usage, or the OSX experience degraded in last 5 years. Again, this is from a sysadmin/developer ki

@listochkin
listochkin / javascript-static-analysis-tools.md
Created August 16, 2013 13:52
JavaScript Static Analysis Tools

JavaScript Static Analysis Tools

Most people are familiar with these three tools:

  1. [JSHint][1]
  2. [JSLint][2]
  3. [Google Closure Linter][3]

The first one is more popular among developers because it is style-agnostic. The other two enforce rules of [Crockford Style][4] and [Google Code Style][5] respectively.

@joemiller
joemiller / raid_ephemeral.sh
Last active October 23, 2023 21:53
detect all ephemeral disks on EC2 then stripe together in a raid-0 vol mounted at /mnt
#!/bin/bash
#
# this script will attempt to detect any ephemeral drives on an EC2 node and create a RAID-0 stripe
# mounted at /mnt. It should be run early on the first boot of the system.
#
# Beware, This script is NOT fully idempotent.
#
METADATA_URL_BASE="http://169.254.169.254/2012-01-12"
@tedb
tedb / README
Created February 17, 2012 23:53
Configuration files for connecting Fedora Linux to Amazon Virtual Private Cloud
Configuration files for connecting Fedora Linux to Amazon Virtual Private Cloud
=====
This Gist contains the config files that I have used to successfully connect Fedora 15 (as the "Customer Gateway" in AWS terms) to Amazon's Virtual Private Cloud VPN. These files were pulled from a working environment but I have obfuscated the public IP addresses involved. I have found IPsec to be one of the more complicated technologies to get running successfully, as there are a lot of moving parts and subtle configuration settings involved. I post this here in the hope it might be of some help to others.
I received a lot of help from this blog post: http://openfoo.org/blog/amazon_vpc_with_linux.html . Besides IPsec, VPC requires BGP; I used basically the same config files shown there. They use Ubuntu, and I am running Fedora, but the upstream software packages used are the same. They call for installing a couple Ubuntu packages; the equivalent on Fedora 15 is:
yum install quagga ipsec-tools
You can read about
@pamelafox
pamelafox / redirect.py
Created February 16, 2012 00:56
App Engine Redirect Handler
"""
Licensed under the Apache License, Version 2.0:
http://www.apache.org/licenses/LICENSE-2.0
"""
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
redirects = {
'/learning': 'http://blog.pamelafox.org',
@Jach
Jach / sieve.py
Created February 7, 2012 18:43
Incremental Sieve of Eratosthenes
'''
Python implementation of Haskell's
sieve xs = sieve' xs Map.empty
where
sieve' [] table = []
sieve' (x:xs) table =
case Map.lookup x table of
Nothing -> x : sieve' xs (Map.insert (x*x) [x] table)
Just facts -> sieve' xs (foldl reinsert (Map.delete x table) facts)
@hwatkins
hwatkins / ratings.rb
Created December 2, 2011 23:15
A script to use the Netflix paginated "What You've Rated" to pull what you have rated in Netflix. This call is not exposed in the Netflix API so it's hard to get any other way. This is quick and dirty so not the best Ruby constructs.
#!/usr/bin/env ruby
require 'iconv'
require 'nokogiri'
# This is a simple script to spider your Netflix paginated "What You've Rated" list.
# It requires an OS X based system with Ruby 1.9+, Safari, and AppleScript
#
# I could not find a way to back up my ratings (for all titles, not just my rental activity)
# without registering for a Netflix API key or handing my Netflix credentials over to someone
# who had an API key, so I decided to take a brute force approach and just parse the HTML for