Skip to content

Instantly share code, notes, and snippets.

View manuphatak's full-sized avatar
🎯
Focusing

Manu Phatak manuphatak

🎯
Focusing
View GitHub Profile

ADR #0001: MusixMatch API

Date: 2020-07-09

Who

Status

# `python-base` sets up all our shared environment variables
FROM python:3.8.1-slim as python-base
# python
ENV PYTHONUNBUFFERED=1 \
# prevents python creating .pyc files
PYTHONDONTWRITEBYTECODE=1 \
\
# pip
PIP_NO_CACHE_DIR=off \
# Response to:
# http://blog.honeybadger.io/how-openstruct-and-hashes-can-kill-performance/
#
# It's not faire to use `Hash.new.merge(data)` if you can `Hash[data]`.
# `Hash[data]` is way faster! Lets compare!
#
# Read more: http://ruby-doc.org/core-2.2.0/Hash.html#method-c-5B-5D
#
# [UPDATE]
#

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@manuphatak
manuphatak / pipeline.py
Last active December 12, 2015 07:03
Idiomatic text processing. Inverting reduce: instead of running one function on a list of values, run a list of functions on one value.
from functools import reduce
def pipeline(steps, initial=None):
def apply(result, step):
yield from step(result)
yield from reduce(apply, steps, initial)
if __name__ == '__main__':
# BEFORE
@manuphatak
manuphatak / default_args_class_decorator.py
Created September 20, 2015 22:08
Class decorator that overrides default kwargs.
from functools import wraps
def defaults(method='__init__', **default_args):
"""Class decorator. Overrides method default arguments."""
def decorate(cls):
func = getattr(cls, method)
@wraps(func)
@manuphatak
manuphatak / css_class.py
Created September 20, 2015 21:43
Django css class tag. Combine conditional classes.
# Python Libraries
import re
# Django Packages
from django import template
register = template.Library()
_re_camel_humps = re.compile('([a-z])([A-Z0-9])')
"""
@akolosov
akolosov / gist:cedaac86b333a4ced95f
Last active December 23, 2019 03:46
vim 7.4 with lua+GUI on Ubuntu 14.04
#!/bin/sh
sudo apt-get remove --purge vim vim-runtime vim-gnome vim-tiny vim-common vim-gui-common
sudo apt-get install liblua5.1-dev luajit libluajit-5.1 python-dev ruby-dev libperl-dev mercurial libncurses5-dev libgnome2-dev libgnomeui-dev libgtk2.0-dev libatk1.0-dev libbonoboui2-dev libcairo2-dev libx11-dev libxpm-dev libxt-dev
sudo mkdir /usr/include/lua5.1/include
sudo ln -s /usr/include/luajit-2.0 /usr/include/lua5.1/include
cd ~
hg clone https://code.google.com/p/vim/
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@wsargent
wsargent / docker_cheat.md
Last active June 29, 2024 19:32
Docker cheat sheet