Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
import argparse
import requests
import sys
TYPES = {
'bytes': {
'param': 'bytes',
#!/usr/bin/env python3
import sys
from itertools import cycle
import time
# https://github.com/yarnpkg/berry/blob/e6e035c901ce921af890be9401076f0123e5393d/packages/yarnpkg-core/sources/StreamReport.ts
PROGRESS_FRAMES = cycle(['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'])
for i in range(60):

Homebrew is pretty frustrating for downgrading, here are the steps (last known version to work with fishis v2.10)

Steps for people in the future that need to do this:

# remove current version
brew uninstall navi

# find formula/bottle
# launches url
brew info --github navi
@lamchau
lamchau / bugsnag_event_exporter.py
Last active September 27, 2020 09:09
Python3 script to download all events from a bugsnag URL
#!/usr/bin/env python3
import collections
from typing import List
import datetime
import distutils.spawn
import hashlib
import json
@lamchau
lamchau / build-tmux.sh
Created September 14, 2020 03:03 — forked from mbreese/build-tmux.sh
HOWTO build a statically linked tmux in one script (downloads and builds dependencies from source)
#!/bin/bash
TARGETDIR=$1
if [ "$TARGETDIR" = "" ]; then
TARGETDIR=$(python -c 'import os; print os.path.realpath("local")')
fi
mkdir -p $TARGETDIR
libevent() {
curl -LO https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz
tar -zxvf libevent-2.0.22-stable.tar.gz
@lamchau
lamchau / go-link-client.py
Created August 23, 2020 04:05
https://www.golinks.io client for learning python3 and argparse
@lamchau
lamchau / cli.py
Created August 22, 2020 07:18 — forked from mivade/cli.py
Using a decorator to simplify subcommand creation with argparse
from argparse import ArgumentParser
cli = ArgumentParser()
subparsers = cli.add_subparsers(dest="subcommand")
def argument(*name_or_flags, **kwargs):
"""Convenience function to properly format arguments to pass to the
subcommand decorator.
#!/usr/bin/env python3
import collections
import logging
import sys
import os
class ColorizedStreamHandler(logging.StreamHandler):
def __init__(self):
@lamchau
lamchau / date-fns.js
Created August 9, 2020 02:57
example date-fns bundler
import differenceInBusinessDays from 'date-fns/differenceInBusinessDays';
import parse from 'date-fns/parse';
import toDate from 'date-fns/toDate';
export default {
differenceInBusinessDays,
parse,
toDate
};
#!/usr/bin/env bash
if ! command -v inkscape &> /dev/null; then
echo "command 'inkscape' could not be found"
exit 1
fi
height=$1
if [[ "$height" -lt 1 ]]; then
echo "$height must be greater than 0"