Skip to content

Instantly share code, notes, and snippets.

mbarkhau

Block or report user

Report or block mbarkhau

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
View perflog.py
"""Context manager for coarse grained performance measurement.
Usage:
with trace("section title"):
your_code_here()
Output:
ts: 0.104 ┌ section title
ts: 123.410 └ d: 123.000 ms
View keybase.md

Keybase proof

I hereby claim:

  • I am mbarkhau on github.
  • I am mbarkhau (https://keybase.io/mbarkhau) on keybase.
  • I have a public key ASDws--anHB5yrkAliIckzEtrPRKXHcRLFPcfU3-JiiqRwo

To claim this, I am signing this object:

@mbarkhau
mbarkhau / weekly-micro-journal-template.html
Created Sep 1, 2019
weekly-micro-journal-template.html
View weekly-micro-journal-template.html
<html>
<head>
<style>
body {
font-family: Bitter;
font-size: 10pt;
}
body, html {
margin: 0;
@mbarkhau
mbarkhau / do_nothing_script.py
Created Jul 22, 2019
do_nothing_script.py
View do_nothing_script.py
#!/usr/bin/env python3
# Based on this https://news.ycombinator.com/item?id=20495739
# I created this boilerplate which I think is a bit nicer to use.
import sys
class AttrDict(dict):
@mbarkhau
mbarkhau / katex_static_test.html
Last active May 17, 2019
Page which includes a statically rendered formula (ie. no javascript).
View katex_static_test.html
<!DOCTYPE html>
<html>
<head>
<title>Test Katex</title>
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/katex@0.10.2/dist/katex.css"
integrity="sha256-SSjvSe9BDSZMUczwnbB1ywCyIk2XaNly9nn6yRm6WJo="
crossorigin="anonymous">
<style type="text/css">
View .bash_prompt
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the active virtualenv
# * the branch of the current git/mercurial repository
# * the return value of the previous command
# * the fact you just came from Windows and are used to having newlines in
# your prompts.
@mbarkhau
mbarkhau / bin ipy
Last active Oct 19, 2019
ipy with default imports
View bin ipy
/home/mbarkhau/miniconda3/envs/py37/bin/ipython -i -c "import io; import os; import re; import sys; import enum; import json; import math; import time; import random; import decimal; import fractions; import collections; import typing as typ; import pathlib as pl; import datetime as dt; import operator as op; import functools as ft; import itertools as it; import subprocess as sp; from math import *; from statistics import *; import numpy as np; import pandas as pd;"
View bin std_tmux
#!/bin/bash
bash /home/mbarkhau/bin/tmush mbarkhau@localhost
@mbarkhau
mbarkhau / watchit.sh
Created Jan 28, 2019
Shell script that is similar to `watch -c`, but output is cleared.
View watchit.sh
#!/bin/sh
HOME=$(tput cup 0 0)
ED=$(tput ed)
EL=$(tput el)
printf '%s%s' "$HOME" "$ED"
while true
do
ROWS=$(tput lines)
COLS=$(tput cols)
CMD="$@"
@mbarkhau
mbarkhau / black_alignment_postproc.py
Last active Sep 10, 2018
black_alignment_postproc.py
View black_alignment_postproc.py
import re
from enum import Enum
from typing import *
FileContent = str
str_contents = """
#!/usr/bin/env python3
You can’t perform that action at this time.