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 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 Feb 6, 2019
ipy with default imports
View bin ipy
/home/mbarkhau/miniconda3/envs/py37/bin/ipython -i -c "import itertools as it; from statistics import *;import functools as ft;import operator as op;import io;import pathlib as pl;import pandas as pd;import numpy as np;import typing as typ;from math import *;import enum;import re;import sys;import os;import ujson as json;import collections;import random;import decimal;import fractions;import time;import datetime as dt;"
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
@mbarkhau
mbarkhau / kinds_of_namedtuple_parameters.py
Last active Sep 7, 2018
kinds_of_namedtuple_parameters.py
View kinds_of_namedtuple_parameters.py
# copied as literally as possible from here
# https://mypy.readthedocs.io/en/latest/kinds_of_types.html#the-type-of-class-objects
from typing import NamedTuple, TypeVar, Type
class Env(NamedTuple):
log_level: str = "DEBUG"
@mbarkhau
mbarkhau / wordlist_256.txt
Last active Aug 3, 2018
wordlist_256.txt
View wordlist_256.txt
# The goal behind this wordlist is to make
# a 1:1 encoding between words/symbols and bytes. It should
# be possible to memorize data encoded with these words.
#
# - Each word has a unique two letter prefix.
# - Each word has high number of syllables, to enable
# reliable verbal communication (like nato code words).
# - Each word has a levenshtein distance >= 3 to any other word
# in the wordlist.
@mbarkhau
mbarkhau / ssh_lib_rtt_test.py
Last active May 30, 2018
ssh_lib_rtt_test.py
View ssh_lib_rtt_test.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import sys
import time
You can’t perform that action at this time.