Skip to content

Instantly share code, notes, and snippets.

View madr's full-sized avatar
🤘
Elixir, React, Phoenix Liveview, Rust.

Anders Englöf Ytterström madr

🤘
Elixir, React, Phoenix Liveview, Rust.
View GitHub Profile
@madr
madr / README
Last active December 13, 2021 08:14
Advent of Code timeline
pip install flask
mkdir templates
mv main.jinja2 templates/
AOC_TOKEN=<adventofcode.com session cookie> FLASK_APP=app flask run
@madr
madr / gist:c0406ddc3cc432fb497fd9be57edb5ba
Created September 21, 2021 07:57
Army Body Composition formula (METRIC SYSTEM), Google Spreadsheet formula
# Males (B2: waist, C2: neck)
# Replace `height` with actual height
# for the imperial system, replace 30,3 with 36,76
=86,01 * Log10(B2 - C2) - 70,041 * log10(height) + 30,3
# Females (B2: waist, C2: neck, D2: hips)
# Replace `height` with actual height
# for the imperial system, replace 104,912 with 78,387
=163,205 * Log10(B2 + D2 - C2) - 97,684 * Log10(height) - 104,912
@madr
madr / shame.css
Last active February 2, 2020 17:17
shame.css
acronym,
applet,
basefont,
big,
center,
dir,
font,
isindex,
menu,
noframes,
@madr
madr / podcast-backup.py
Last active October 19, 2019 10:46
Podcast backup script
"""
Podcast backup script
Parses an RSS feed from SOURCE_FILE and download all items to
DESTINATION_PATH. Downloads are done in parallel, for
PARALLEL_COUNT downloads at the time.
How to use
----------
function encrypt (str) {
return str.replace(/([^aeiouöäå01-9])/gi, (c) => { return `${c}o${c}`; });
}
function decrypt (str) {
return str.replace(/([^aeiouöäå01-9])o([^aeiouöäå01-9])/gi, (origin, first, last) => {
return (first == last)? first: origin;
});
}
## OS X
Installing Radicale on OS X is almost as easy as it is for Linux or *BSD.
OS X comes with Python preinstalled, but not version 3. Go to [python.org](https://www.python.org/downloads/mac-osx/) and download the latest version of Python. Run the installer.
It is also possible to install Python 3 using `brew` by typing `brew install python3` in a Terminal window.
Then launch a Terminal window, and type:
@madr
madr / hijax.js
Last active October 25, 2016 11:48
(function (g) {
"use strict";
var hijax;
hijax = function (method, uri, data, onSuccess, onError) {
var client = new XMLHttpRequest();
if (onError == undefined) {
onError = function (status, response) {
alert('you have been found guilty of being in league with the devil ' +
var hijax = function (method, uri, callback) {
var client = new XMLHttpRequest();
client.open(method, uri, true);
client.onload = function () {
if (client.status >= 200 && request.status < 400) {
callback(client.responseText);
}
};
@madr
madr / Jimmie special.md
Last active October 17, 2018 15:05
Menyn

Jimmie special 29:-: En burk Kung Gustavs sardiner, serveras med en påse chips (60g) och en lättöl

@madr
madr / javascript.js
Last active January 21, 2016 11:54
String replacement using regular expressions
var results = 'hi bob123';
results = results.replace(/bob\d+/, 'cooper');