Skip to content

Instantly share code, notes, and snippets.

View amontalenti's full-sized avatar

Andrew Montalenti amontalenti

View GitHub Profile
@amontalenti
amontalenti / ssh-persistent-control-master.md
Last active May 24, 2024 17:35 — forked from rtomayko/ssh-persistent-control-master.md
10x SSH connection speedup w/ persistent control masters

SSH Persistent Control Master Config

Add to ~/.ssh/config:

Host *
  # Enable persistent connection multiplexing
  ControlMaster auto
  ControlPath ~/.ssh/sockets/-%r@%h:%p
 ControlPersist 600

Keybase proof

I hereby claim:

  • I am amontalenti on github.
  • I am amontalenti (https://keybase.io/amontalenti) on keybase.
  • I have a public key ASCtP_ibM-nhDduaxOmYb5jdmpYNLt16lMGBT3yiuykq2Ao

To claim this, I am signing this object:

{
"action": "pageview",
"apikey": "mashable.com",
"campaign_id": "facebook",
"display": true,
"display_avail_height": 735,
"display_avail_width": 1280,
"display_pixel_depth": 24,
"display_total_height": 800,
"display_total_width": 1280,
# simple script converts my Google Chrome bookmarks for my "Dashes"
# folder into a Markdown list so I can share it on the Parse.ly wiki
import json
import os
POSITION = 8
bookmarks = json.load(open("%s/.config/google-chrome/Default/Bookmarks" % os.environ["HOME"]))
dash_links = bookmarks["roots"]["bookmark_bar"]["children"][POSITION]["children"]
class BadStr(str):
def __str__(self):
berak
def strip(self):
return self
import sys
# surprisingly, no exception thrown for this
sys.stdout.write(BadStr())
SELECT title, views FROM [test.parselyblog]
-- utilities
-- STRFTIME_UTC_USEC(pub_date, "%Y-%m")
-- SUM(views)a
-- COUNT(distinct url)
-- find dupes
-- ----------
line:
/plogger/?rand=1459810331846&idsite=deadspin.com&url=http%3A%2F%2Fscreengrabber.deadspin.com%2Fadrien-broner-tries-to-call-out-floyd-mayweather-turns-1768674744%3Futm_medium%3Dsharefromsite%26utm_source%3DScreengrabber_facebook&urlref=http%3A%2F%2Ffacebook.com%2Finstantarticles&screen=360x640%7C360x640%7C32&data=%7B%22parsely_uuid%22%3A%2227bdf3ea-1f69-4db0-aa78-8e90e1e217f1%22%2C%22parsely_site_uuid%22%3A%22c0349257-2cea-4864-a74d-18acd8e7c631%22%7D&sid=1&surl=http%3A%2F%2Fscreengrabber.deadspin.com%2Fadrien-broner-tries-to-call-out-floyd-mayweather-turns-1768674744%3Futm_medium%3Dsharefromsite%26utm_source%3DScreengrabber_facebook&sref=&sts=1459810321317&slts=0&date=Mon+Apr+04+2016+17%3A52%3A11+GMT-0500+(CDT)&action=heartbeat&inc=5 HTTP/1.1 || 200 || 236 || http://screengrabber.deadspin.com/adrien-broner-tries-to-call-out-floyd-mayweather-turns-1768674744?utm_medium=sharefromsite&utm_source=Screengrabber_facebook || [FBIA/FB4A;FBAV/70.0.0.22.83;] Mozilla/5.0 (Linux; Android 5.0; SM-N900T Build/LRX21V
import turtle
t = turtle.Turtle()
t.color('orange')
# self-test
t.left(180)
t.left(-180)
# this is a U
t.right(90)
@amontalenti
amontalenti / factories.py
Created January 20, 2016 12:00
Examples of using collections.namedtuple and collections.defaultdict, the "factory" collection types
"""
Example of using namedtuple:
>>> from collections import namedtuple
>>> Point = namedtuple("Point", "x y")
>>> point = Point(1, 2)
>>> point
Point(x=1, y=2)
>>> point.x
1
@amontalenti
amontalenti / tree.py
Last active January 20, 2016 12:00
Example of defining a custom data structure for arbitrarily-nestable trees.
class Tree(dict):
"""A Tree is a dict-like object that nests arbitrarily.
It supports both `tree["key"]` and `tree.key` syntax for lookups.
A lookup for a missing key, by either syntax, results in creation
of a new nested tree, e.g.
>>> tree = Tree()
>>> tree.a.b.c = "d"
>>> tree