Skip to content

Instantly share code, notes, and snippets.

View TwP's full-sized avatar
🛰️
Spacing Out

Tim Pease TwP

🛰️
Spacing Out
View GitHub Profile

UniFi Sonos Configuration

Our goal today is to configure a VLAN for "Internet of Things" devices that is sequestered from our default private network. Devices on the private network are free to initiate connections into our IoT VLAN, but devices in the IoT VLAN should not be able to initiate connections to one another or to the private network.

The focus of this document is the configuration of UniFi system to allow Sonos speakers to operate across VLANs. Creating the VLAN itself is left to the user (there are many other guides out there that cover this topic). For our discussion, here are the networks we'll be working with:

  • 10.1.1.0/24 - this is our Private network where our trusted devices live.
  • 10.1.20.0/24 - this is our IoT network configured as VLAN 20; Sonos devices live here.

Sonos Speakers

Each Sonos speaker is assigned a static IP address via a DHCP reservation. These static IP addresses enable us to write some targeted firewall to allow the Sonos software to work across our V

This past week I was wondering what are the most often used emoji on GitHub issues, pull requests, and comments. After a little bit of scripting this is the resulting list.

Each emoji is only counted once per text block. If a comment contains the ⚡ emoji five times, it is only counted once in the resulting statistics.

Future ideas for useless emoji research:

  • emoji trends over time to track the rise in popularity of a given emoji
@TwP
TwP / logging_leak_test.rb
Created March 22, 2015 03:55
hunting down memory leaks
NUM_FORKS = 15
NUM_ITERATIONS = 250
STDOUT.sync = true
require 'logging'
module Logging
def self.show_diagnostic_contexts( io = STDOUT )
Thread.exclusive do

Come Search GitHub

GitHub is in the business of collaboration and connecting people to projects they are interested in. Search plays a key role in discovering new projects, and we are looking for someone to join us in making GitHub search an outstanding experience.

At the heart of the GitHub search experience is ElasticSearch, a Lucene-based distributed search and analytics engine running on the Java virtual machine. As we have expanded

@TwP
TwP / es_boolean_query.json
Created September 13, 2012 00:09
ElasticSearch multi-term query
{ "query" : {
"bool" : {
"should" : [
{ "term": { "user_ids": 2 }},
{ "term": { "content": "foobar" }}
],
"minimum_should_match": 1
}
}}
# In ruby you can implicitly continue a function call to the next line by
# breaking after the period. This is used to great advantage in RSpec files.
#
# I find that putting the "should" expectation on a new line makes the code
# more readable, and it ameliorates the 80 char line problem in tests.
describe "The::Dude" do
let(:dude) { The::Dude.new 'Jeffrey', 'Lebowski' }
@TwP
TwP / at_exit.rb
Created January 6, 2012 17:16
at_exit callback ordering
# The purpose of this experiment is to see if we can force our at_exit handler
# to be the very last one invoked regardless of the order in which the at_exit
# handlers are registered. The Ruby documentation states that the at_exit
# handlers are called in the reverse order in which they are registered. So
# the first one registered is the last one called.
at_exit { STDOUT.puts "first" }
at_exit {
STDOUT.puts "second"
@TwP
TwP / dw.rb
Created December 14, 2011 16:53
Test scripts for the directory_watcher gem
#!/usr/bin/env ruby
require 'rubygems'
$:.unshift 'lib'
Thread.abort_on_exception = true
require 'logging'
include Logging.globally
require 'directory_watcher'
{
"filter": { "bool": {
"must": [
{ "prefix": { "_id": "http://www.example.com" }}
]
}}
}
@TwP
TwP / explicit_cache.json
Created November 7, 2011 21:58
Examples of ES Filter Cache
{
"filter": {
"and": { "_cache": true, "filters": [
{ "or": { "_cache": true, "filters": [
{"prefix": { "_id": "http://www.example.com" }}
]}},
{ "not": { "_cache": true, "filter": { "or": { "_cache": true, "filters": [
{"term": { "_id": "http://www.example.com" }},
{"term": { "_id": "http://www.example.com/sitemap" }},