Skip to content

Instantly share code, notes, and snippets.


Keyan Pishdadian keyan

Block or report user

Report or block keyan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
keyan /
Created Aug 6, 2019
bash script that curls a url every minute and outputs audio if a regex doesn't match
check_for_opening () {
res=`curl --silent "" | grep "Next opening"`
if [ -n "`echo $res | grep -e '.*Thursday, September 5.*'`" ]
echo "No openings found, sleeping..."
say "Found an appointment opening"
keyan / lmdb.tcl
Created Feb 27, 2019 — forked from antirez/lmdb.tcl
LMDB -- First version of Redis written in Tcl
View lmdb.tcl
# Copyriht (C) 2009 Salvatore Sanfilippo <>
# All Rights Reserved
# - cron with cleanup of timedout clients, automatic dump
# - the dump should use array startsearch to write it line by line
# and may just use gets to read element by element and load the whole state.
# - 'help','stopserver','saveandstopserver','save','load','reset','keys' commands.
# - ttl with milliseconds resolution 'ttl a 1000'. Check ttl in dump!
keyan / dark.css
Last active Feb 27, 2019
slack dark mode css
View dark.css
body { background: #222; color: #e6e6e6; }
a { color: #949494; }
a:link, a:visited { color: #949494; }
a:hover, a:active, a:focus { color: #c7c7c7; }
hr { border-bottom: 1px solid #424242; border-top: 1px solid #222; }
keyan /
Created Feb 15, 2019
A small helper script for quickly parsing agency GTFS-RT feeds for debugging
A small helper script for quickly parsing agency GTFS-RT feeds for debugging.
$ service_venv python3 --help
import argparse
import requests
from google.transit import gtfs_realtime_pb2
keyan /
Created Nov 1, 2018
Apply a func to a target class to any fields and items nested within an object
def nested_map(obj: object, func, target_class) -> Any:
Accepts any object type and calls .func() on any nested fields of the specified class.
def _nested_map(obj: object) -> None:
Traverse all object fields and list items, calling func when possible.
# Objects without __dict__ cannot have vars() called
if not hasattr(obj, '__dict__'):
keyan /
Last active Mar 19, 2018
Disabling Python's SSL verification

It is pretty confusing how to add custom root certificates to Python's trusted cert list as it doesn't use system certs. Instead I just disabled verification entirely. Note this is for local development only and SHOULD NOT BE USED IN PRODUCTION:


This is helpful for capturing and inspecting outbound packets using Charles proxy or a similar tool.

keyan /
Last active Jul 16, 2019
Chef <-> Salt <-> Puppet terminology equivalence

Recently I have had to deal with Salt configuration. I am doing product work so I didn't want to focus too much on deeply grasping Salt, but instead knowing the terminology equivalents to Chef/Puppet which I am comfortable with.

Salt Chef Puppet
state resource resource
states recipes manifests
formula* cookbook module
pillars databags hiera
grains ohai facter
keyan /
Created Jan 19, 2018
Implement a "fair lock"
A "fair lock" is a lock which guarantees threads are given access in
the order that they requested it. The whole idea here is just to play
with the concurrency control ideas, because Python's Queue
implementation is already threadsafe, therefore acheiving the same
behavior as the FIFO lock below.
import threading
keyan /
Created Jan 4, 2018
Some notes on how to setup spinnaker and use halyard


  • Halyard must be run on Ubuntu 14.04 (Trusty), you will likely use a VM to run it:
$ vagrant init ubuntu/trusty64; vagrant up --provider virtualbox
  • Sync your local kubeconfig with the guest VM by adding the following line to your newly created Vagrantfile:
keyan /
Last active Jan 4, 2018
A script you can run in your repo to scan for TODO messages and email the authors asking them to fix it! Can be easily adapted for other search strings.
This script searches the git repo looking for TODO messages, determines the
author of the line, then emails that author asking them to repair the issue.
It is intended to be run at a regular interval on a CI server or cron-job
server. By changing the `SEARCH_STRING` the script can be easily adapted to
trigger on any undesired code.
You can’t perform that action at this time.