Skip to content

Instantly share code, notes, and snippets.

def window(seq, n=2):
"Returns a sliding window (of width n) over data from the iterable"
" s -> (s0,s1,...s[n-1]), (s1,s2,...,sn), ... "
it = iter(seq)
result = tuple(islice(it, n))
if len(result) == n:
yield result
for elem in it:
result = result[1:] + (elem,)
yield result
combo = collections.deque([1,2,3])
tumbler = collections.deque([0]*len(combo),len(combo))
def incoming_temp(temperature):
tumbler.append(temperature)
if (tumbler == combo):
disarm()
curl 'https://api.home.nest.com/oauth2/access_token' -d 'client_id=<APP_ID>&client_secret=<APP_SECRET>&code=<MY_CODE>&grant_type=authorization_code'
@jakeyr
jakeyr / safe.md
Created November 29, 2016 17:57 — forked from bryanrite/safe.md
Safe Postgres Operations on High Volume Tables

Originally taken from: Braintree Article and expanded on by me.

Safe

  • Add a new column
  • Drop a column
  • Rename a column
  • Add an index concurrently (Example), Note: it will still take a long time to run the migration, but it won't write-lock the table.
  • Drop a constraint (for example, non-nullable)
  • Add a default value to an existing column

Pragmatism

We focus on work that drives business value and gets us closer to accomplishing our mission. We don't solve problems that we don’t have, and we don’t build technology for technology's sake.

Simplicity

We are always thinking “is there less I can do to solve this problem?”. We excel at delivering tools and products that hide complex problems behind simple abstractions.

Relentlessness

We work intensely and creatively to deliver solutions on time with high quality. We are unwilling to let ourselves be blocked or stuck, because our mission is important, and we care strongly.

Collaboration

<!-- button.hbs -->
<div class="control-group">
<button class="{{btnClass}}"
id="{{btnId}}"
value="{{label}}">
{{label}}
</button>
</div>
<!-- input.hbs -->
<div class="control-group>
@jakeyr
jakeyr / GridHubInstall.ps1
Last active August 29, 2015 14:26 — forked from dlai0001/GridHubInstall.ps1
Boxstarter formula for settings up Selenium Grid
##############################################################################################
# Powershell script for installing Selenium Grid Extras in Hub Mode
# Navigate with internet explorer to:
# http://boxstarter.org/package/nr/url? + raw gist url
#
##############################################################################################
# Boxstarter options
$Boxstarter.RebootOk=$true # Allow reboots?
$Boxstarter.NoPassword=$false # Is this a machine with no login password?
Here is a card 4444444444444444
also another 4242424242424242 that is inside
Rumbustions of the world, unite!
Hello, fellow would-be disciples of the cove!
I believe the time has come for the three of us to embark on our epic journey to the warm shores of the tropics as we sample that most notorius of equitorial libations, rum! Or as the french say, Rhum.
The Rumbustion society calls to you sirs. Will you answer?
http://smugglerscovesf.com/trapdoor/rumbustion-society/
@jakeyr
jakeyr / squid.bash
Created April 26, 2012 00:07 — forked from noahcampbell/squid.bash
Collectd script for squid
# Steps for turning on squid monitoring (until I have an rpm)
cat > /etc/collectd/conf/squid << EOF
LoadPlugin exec
<Plugin exec>
Exec deploy "/var/lib/releng/monitoring/squid"
</Plugin>
EOF
mkdir -p /var/lib/releng/monitoring