Skip to content

Instantly share code, notes, and snippets.

History

If you work in the shell long enough your history will become your own personal reference. It's like automatic documentation which is the best kind of documentation.

Configuration

Unfortunately, the default configuration for history is not always great. You should already be familiar with variables such as $HISTFILE and $HISTSIZE.

@muendelezaji
muendelezaji / payment-reference.py
Last active May 19, 2023 18:22
Create a simple unique payment reference to send to a provider
from datetime import datetime
def generate_payment_ref(email, method, country):
"""
Generates a unique payment reference that will be sent to the payment provider.
Examples of returned references:
- TENDA-TZ-CARD-20230519-181549-acustomer@somedomain.com
- TENDA-TZ-PUSH-20230519-181549-acustomer@somedomain.com
- TENDA-TZ-BANK-20230519-181549-acustomer@somedomain.com
@muendelezaji
muendelezaji / diff_email_body.py
Created December 11, 2022 14:28
SendGrid - different email body depending on recipient status
# 1. Create dynamic body depending on status
if user_status == "paid":
body = f"Hello paid user: {user.first_name} {user_status}"
else:
body = f"Hello not paid user: {user.first_name} {user_status}"
# 2. Add it to recipient email substitutions
to_emails.append(
To(
email=user.user_email,
@muendelezaji
muendelezaji / get_pr.go
Last active November 4, 2022 01:52
Get PR number from a GitHub URL
// Derived from paste at https://pastebin.com/iwqG6zvH
// Lightly edited to make it run
// Original discussion: https://t.me/GolangTZ/475
// You can edit this code!
// Click here and start typing.
package main
import (
"bufio"
@muendelezaji
muendelezaji / bash.git-prompt.sh
Created September 1, 2020 17:24
Customize Bash PS1 prompt to show current status of active Git branch
# Customize Bash PS1 prompt to show current status of active Git branch.
# Adapted from and inspired by http://mediadoneright.com/content/ultimate-git-ps1-bash-prompt
# Slightly faster prompt, as measured on my machine (TM)
#
# By @muendelezaji, Oct 2015
# Skip if in zsh
[ "$ZSH" ] && return 0
# SETUP CONSTANTS
@muendelezaji
muendelezaji / tableau10.mplstyle
Last active March 5, 2020 02:40 — forked from rhiever/tableau10.mplstyle
Custom style (Tableau-inspired) for matplotlib plots in Jupyter Notebooks
# Author: Randal S. Olson (randalolson.com / @randal_olson)
# Uses Tableau's Tableau10 color scheme
#
# In Notebook, use it as follows:
# plt.style.use('https://gist.githubusercontent.com/muendelezaji/75fe7ca33ac3b47730ba85378459a206/raw/1b807615235ff6f4c919b5b70b01a609619e1e9c/tableau10.mplstyle')
figure.figsize: 12, 7
figure.edgecolor: white
figure.facecolor: white
@muendelezaji
muendelezaji / README.markdown
Created October 14, 2019 21:47 — forked from alexshk/README.markdown
List of countries in YAML, CSV and TXT format
@muendelezaji
muendelezaji / 0001-tflite-allow-fp16-for-fp32-models.patch
Last active February 11, 2020 13:22
Script to build TFLite benchmark_model tool and label_image demo for Android (arm64) including patches for FP16 support and optional RUY support
From b5a99e2174f115f87c0cb3de9d2a2479a0193db2 Mon Sep 17 00:00:00 2001
From: Koan-Sin Tan <[email protected]>
Date: Sun, 18 Nov 2018 13:11:38 +0800
Subject: [PATCH 1/3] add cmdline option to allow running fp32 models with fp16
Add an option for TFLite benchmark_model to allow running fp32
models with fp16. Useful when testing NNPAI accelerators with
fp16.
---
.../lite/tools/benchmark/benchmark_tflite_model.cc | 9 ++++++++-
@muendelezaji
muendelezaji / build-tensorflow.sh
Last active December 1, 2021 19:27 — forked from PatWie/update-tensorflow.sh
Script to build TensorFlow from source. Platform is ARM64 (aka aarch64) with OpenCL support via Codeplay SYCL SDK
#!/bin/bash
# =============================================================
# UPDATE SOURCE
# =============================================================
# git clone https://github.com/tensorflow/tensorflow
# git checkout -- .
# git pull origin master
# TF_BRANCH=r1.8
TF_ROOT=/home/tensorflow
@muendelezaji
muendelezaji / Dockerfile
Last active February 21, 2018 14:04
Vagrant and Docker setups for the ARM Computer Vision and Machine Learning library - https://github.com/ARM-software/ComputeLibrary
# Docker
FROM ubuntu:xenial
# Install developer tools
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get -y update && apt-get -y install \
build-essential \
g++-arm-linux-gnueabihf \
git \
openjdk-8-jdk \