Skip to content

Instantly share code, notes, and snippets.

@crc442
crc442 / python-makefile
Created August 4, 2021 18:58
python makefile
In the following snipped you can find an example how my Makefiles might look like.
```python
.PHONY: prepare_venv cache build deploy
VENV_NAME?=venv
PYTHON=${VENV_NAME}/bin/python
prepare_venv: $(VENV_NAME)/bin/activate
const template = (str, delim) => (...args) => {
let result =
str.split(delim.open)
.map(s => s.split(delim.close))
let argIndex = 0;
result.forEach(element => {
if (element.length > 1) {
element.shift();
element.unshift(args[argIndex]);
SHELL := /bin/bash
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'

Keybase proof

I hereby claim:

  • I am crc442 on github.
  • I am imcrc (https://keybase.io/imcrc) on keybase.
  • I have a public key ASCopgfK5xpnAHAKvHjFOkqf54PgjYozLJb-jxSa5522vgo

To claim this, I am signing this object:

# Taken from TJ Holowaychuk: http://tjholowaychuk.com/post/26904939933/git-extras-introduction-screencast
alias gd="git diff | mate"
alias ga="git add"
alias gbd="git branch -D"
alias gst="git status"
alias gca="git commit -a -m"
alias gm="git merge --no-ff"
alias gpt="git push --tags"
alias gp="git push"
// prototypal inheritance 'create' (utility) meathod
create: function(values) {
var instance = Object.create(this); //Object.create only in > IE8, so this can be done is only >IE8
Object.keys(values).forEach(function(key)) {
instance[key] = values[key];
}
return instance;
}
// Use it like this
// pubsub pattern utility funtion
var events = {
events: {},
subscribe: function(eventName, fn) {
this.events[eventName] = this.events[eventName] || [];
this.events[eventName].push(fn);
},
// classical inheritance pattern utility function
function inherits(classCtor, baseClassCtor) {
classCtor.super_ = baseClassCtor;
classCtor.prototype = Object.create(baseClassCtor.prototype, {
constructor: {
value: classCtor,
enumerable: false,
writable: true,
configurable: true
@{
@"Alabama" : @"AL",
@"Alaska" : @"AK",
@"Arizona" : @"AZ",
@"Arkansas" : @"AR",
@"California" : @"CA",
@"Colorado" : @"CO",
@"Connecticut" : @"CT",
@"Delaware" : @"DE",
#what-npm-is-for:after {
-webkit-animation: cursor-blink 0.8s linear infinite;
-moz-animation: cursor-blink 0.8s linear infinite;
-o-animation: cursor-blink 0.8s linear infinite;
animation: cursor-blink 0.8s linear infinite;
content: "|";
color: #cb3837;
padding-left: 3px;
}