Skip to content

Instantly share code, notes, and snippets.

Avatar

Blaine Booher booherbg

View GitHub Profile
@booherbg
booherbg / gist:b083cac2982f4e0ae590
Last active Aug 29, 2015
Reasons I like Golang
View gist:b083cac2982f4e0ae590

For my own reminders...

General

  • Go is fun, like python fun.
  • Structs are fun, easy to use
  • maps are fun, easy to use
  • Pointers, references act as you'd expect them to
  • Duck typing, static typing mix
  • Feels expressive, like python. Compiled and fast, like C++
View gist:d2082d7e54f2807654e8
During install, my /dev/sda was not recognized (even though fdisk -l shows it). I did, however, get prompted about enabling RAID devices.
blkid /dev/sda
/dev/sda: UUID="DELL ^P(" TYPE="ddf_raid_member"
dmraid -E -r /dev/sda
Do you really want to erase "ddf1" ondisk metadata on /dev/sda? y/n :y
ERROR: ddf1: seeking device "/dev/sda" to 12803086946048
ERROR: writing metadata to /dev/sda, offset 250059349504 sectors, size 0 bytes returned 0
ERROR: erasing ondisk metadata on /dev/sda
@booherbg
booherbg / gist:a075b307a234772eee44
Created Apr 9, 2015
Database migrations with SQLAlchemy, Flask, Elixir, SQLite
View gist:a075b307a234772eee44
I have a project that was built 3 years ago, back before Elixir stopped being maintained. As projects have a tendancy to do, it's now time for an update. I've learned a lot in the last 3 years, and am looking forward to adding database migrations to the project. At the same time, if it aint broke don't fix it. I'm keeping Elixir in place, as it works well for our needs. However, Flask-Migrate relies on direct access to an SQLAlchemy object. I'm keeping is simple and going directly to the source: alembic.
The nice thing about this is that I can do the migrations directly on the db, without needing Elixir or any of our app logic.
``` bash
$ alembic init alembic
$ alembic revision -m "adding fields to media: id, filename_uploaded, and tags"
Generating /data/cliftonlabs/sportsvision/alembic/versions/4b7eedb40b12_adding_fields_to_media_id_filename_.py ... done
```
@booherbg
booherbg / metadata-examples.md
Last active Aug 29, 2015
Cool examples of meta data on Google
View metadata-examples.md

Interesting examples of meta data by Google

  1. Etymology Charts -- when searching for the history of a word, using "etymology" as a keyword in the search, we are presented with a chart that shows interesting information about the word (in this case, 'crass'). For example, I immediately learn that it comes from 'crassus', Latin for 'thick or dense'. I see that it stems from the late 15th century. There is also a graph showing the usage over time from the 1850s, likely based on references in scanned literature (my guess). As a side note, it would be fascinating to see different charts normalized against things like population growth, printing technology improvements, or whether it was driven by a true cultural shift, like an influx in population from one region to another (or, into American cities like Cincinnati), or usage in a popular play (that can reach more people now due to printing press innovations and, lat
@booherbg
booherbg / gist:e93ec212bf1255432717
Last active Aug 29, 2015
Google Chrome Pending network calls on html5 video -- fix
View gist:e93ec212bf1255432717

Google Chrome Pending video status

There's an outstanding bug in Google Chrome where video resources aren't properly closed after download, so the socket limit gets maxed and subsequent videos (and all ajax calls) hang. https://code.google.com/p/chromium/issues/detail?id=234779

I tried, with no success:

  • Removing the tag after unload (in an attempt to force the resource to be released)
@booherbg
booherbg / unknown_protocol.md
Last active Aug 29, 2015
SSL unknown protocol -- python, ruby
View unknown_protocol.md

Started having some strange behavior today.

My ruby deploy script (via mina) was crashing on irc notifications.

OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=unknown state: unknown protocol

Later in the day, a few of our client software scripts could only connect 2-at-a-time (when one would drop, a third would join in its place). When I dug into the guts of it, the python error message was:

@booherbg
booherbg / rails-apartment-notes.md
Last active Aug 29, 2015
Adding apartment to our api project
View rails-apartment-notes.md
  1. add apartment to gemfile
  2. run initializer to generate config/apartment.rb
  3. Create our Event model (which maps to schemas)
  4. before_validate: create self.schema that uses .parameterize.underscore from self.name on event model
  5. after_create: create new apartment tenant on the event model
  6. Set up the config to ignore a few of our models that are public
  7. hard code the config to select a single event schema, for now
  8. migrate over all the data:
View gist:d3e71651534aeedbbaf680af44d1f9b3

Notes on upgrading to Elasticsearch 5.0.1 from 2.4

First get the latest ES (2.4):

# apt-get update
# apt-get install elasticsearch

After update, had to reinstall license and marvel
# bin/plugin remove license
@booherbg
booherbg / gist:cc09bb8bc66fae56f60e
Last active Jun 27, 2017
Getting started with Tensor Flow (Installation)
View gist:cc09bb8bc66fae56f60e
View Project Crows.md

Jun 25 2017

Interested in becoming friendly with local crows after reading stories and first hand accounts. Obtained peanuts. Later, found grackles, but not crows. They're smaller and travel in larger flocks. Were not very interested in peanuts. They have irridescent blue heads. Curious if the small blue glass left in my garden is from the crows?

Squirrels like peanuts too. I threw a peanut towards an squirrel and it bounced off him. It did not phase him. He ate the peanut.

Jun 27 2017