Skip to content

Instantly share code, notes, and snippets.

@yarko
yarko / json2yaml
Created December 16, 2016 20:29
Simple json / yaml conversions
#!/usr/bin/env python
from os import path
import sys
import json
import yaml
if len(sys.argv) > 1:
print("usage:\n\t{} < your_json_file > your_yaml_file".format(
path.basename(sys.argv[0])))
@yarko
yarko / batch-delete-gmail-emails.js
Last active December 12, 2020 14:53 — forked from gene1wood/batch-delete-gmail-emails.js
A Google Apps Script script to bulk delete large amounts of email in Gmail while avoiding the error #793 which Gmail encounters normally
# This script, when used with Google Apps Scripts will delete 500 emails - the amount the API will return with one call.
# It can be triggered to run periodically (I set @ 5 minute, since it runs slow) without user interaction
# enabling you to bulk delete email in Gmail without getting the #793 errors, etc., from Gmail.
# Configure the search query in the code below to match the type of emails you want to delete
# See - https://developers.google.com/apps-script/reference/gmail/gmail-app#search(String)
# and https://support.google.com/mail/answer/7190?hl=en
# Browser to https://script.google.com/.
# Start a script and paste in the code below.
@yarko
yarko / build-pythonv3.6.0.sh
Last active December 23, 2016 20:24
Build Python v3.6.0 release on os/x from github sources, where brew has installed (co-reside w/ your other pythons)
#!/usr/bin/env sh
# NOTE: keeping this gist for 3.6.0 release, because I want to keep 3.5 around for a bit too;
# Here is how I built Python v3.6.0b1...onward
# on OS/X, where brew is installed
# (and python2.7 and python3.5 installed by brew):
# make sure you have openssl installed (this is for installing pip)
# and a recent tcl-tk, if you're going to use idle
# (see https://www.python.org/download/mac/tcltk/ for more info)
# If you have them installed, you might want to `brew upgrade` them.
@yarko
yarko / session_staff.py
Last active July 19, 2023 00:19
PyCon Session Staff reporting tool; what started as 6 quick lines of code, has a ways to go to be "portable" year-to-year, but coming along...
#!/usr/bin/env python
'''
usage:
session_staff [<url>]
session_staff --report [<kind>] [<url>]
session_staff --version
session_staff --debug
options:
@yarko
yarko / plantuml_magics.py
Last active November 2, 2015 00:09 — forked from sberke/plantuml_magics.py
An Plantuml extension for generating UML figures from within ipython notebook.
"""
An Plantuml extension for generating UML figures from within ipython notebook.
Source: http://stackoverflow.com/questions/20303335/ipython-notebook-plantuml-extension
See example notebook at: http://nbviewer.ipython.org/gist/sberke/bb90ff09193a8888d7f7
"""
import os
from IPython.core.magic import magics_class, cell_magic, Magics
from IPython.display import Image, SVG
@yarko
yarko / clear_list.py
Last active October 30, 2015 18:22
Clear List (python) - the confusion of slice-assignment vs. slice selection
def clear(alist):
'''clear(alist)
when you want the contents of a list cleared,
so that all references to that list are affected.
python3 has a clear() method on lists;
there are at least 3 other ways to accomplish the same,
two of them syntactically tricky, and obscure.
@yarko
yarko / python3-link.sh
Last active August 29, 2015 14:27
mac homebrew python3 devel install prioritization & link checks

Keybase proof

I hereby claim:

  • I am yarko on github.
  • I am yarkot (https://keybase.io/yarkot) on keybase.
  • I have a public key whose fingerprint is F5AA 9AFA 0273 A0CF 8500 9845 8E77 6F94 BF39 12FA

To claim this, I am signing this object:

@yarko
yarko / Literacy-and-Formal-Proofs.md
Last active August 29, 2015 14:16
Timsort Fix, partially clarified

Recently, I saw proponents of automated tools show a bug found in the timsort hybrid sorting algorithm.

It's been widely used, and ported, so this is with some pride that proponents of a particular approach gloat, with cause.

http://envisage-project.eu/proving-android-java-and-python-sorting-algorithm-is-broken-and-how-to-fix-it/#sec3

But several things stand out. The solution is what SEI would have named "low maturity" (not quite - the article did go through it elsewhere):

  • it copy / paste's what was and what is, leaving it to the reader to discover what changes were made;