Skip to content

Instantly share code, notes, and snippets.

View macbre's full-sized avatar
🏠
Working from home

Maciej Brencz macbre

🏠
Working from home
View GitHub Profile
@macbre
macbre / bygd_2022.tsv
Last active February 12, 2022 20:20
Faroe Islands - IB01030 Population by sex, age, village/city and month(1985-2022)
We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 41 columns, instead of 40 in line 3.
"sex" "age" "village/city" "1985 Jan" "1986 Jan" "1987 Jan" "1988 Jan" "1989 Jan" "1990 Jan" "1991 Jan" "1992 Jan" "1993 Jan" "1994 Jan" "1995 Jan" "1996 Jan" "1997 Jan" "1998 Jan" "1999 Jan" "2000 Jan" "2001 Jan" "2002 Jan" "2003 Jan" "2004 Jan" "2005 Jan" "2006 Jan" "2007 Jan" "2008 Jan" "2009 Jan" "2010 Jan" "2011 Jan" "2012 Jan" "2013 Jan" "2014 Jan" "2015 Jan" "2016 Jan" "2017 Jan" "2018 Jan" "2019 Jan" "2020 Jan" "2021 Jan" "2022 Jan"
"Total (sex)" "Total (age)" "Total Faroe Islands" 45347 45677 46240 46880 47570 47772 47347 47203 46735 45259 43640 43323 43745 44226 44760 45342 46127 46941 47648 48146 48299 48120 48262 48302 48603 48485 48431 48178 48029 48122 48590 49099 49791 50462 51273 52103 52899 53664
"Total (sex)" "Total (age)" "Hattarvík" 27 27 27 30 36 37 29 33 40 39 32 30 26 24 22 20 20 18 17 16 17 16 15 16 15 16 17 15 14 14 14 13 13 12 11 11 11 10
"Total (sex)" "Total (age)" "Kirkja" 35 32 32 25 24 24 24 24 24 30 22 21 18 18 19 20 30 30 28 29 28 27 28 26 25 22 22 22 23 28 26 27 32 25 26 27 30
@macbre
macbre / README.txt
Created October 28, 2021 11:38
ts-jest setup
npm remove @types/mocha mocha
npm i --save-dev @types/jest jest
npm i --save-dev ts-jest
npx ts-jest config:init
and provide testRegex entry in jest.config.js file.
@macbre
macbre / fonts.py
Created April 5, 2021 13:48
Font encoder for MAX7129
# fonts are encoded by columns
# first value is the first column from the left
# now, we want to have them encode by rows (starting from the botton one)
# { 0x00, 0xf8, 0x88, 0x88, 0x88, 0x88, 0x88, 0xf8 }, // 0
# see https://github.com/rm-hull/luma.led_matrix/blob/0.2.3/max7219/font.py#L84-L93
CP437_FONT = [
[0x3E, 0x7F, 0x71, 0x59, 0x4D, 0x7F, 0x3E, 0x00], # '0'
[0x40, 0x42, 0x7F, 0x7F, 0x40, 0x40, 0x00, 0x00], # '1'
@macbre
macbre / export_to_pdf.sh
Last active December 16, 2020 19:38
calendar
#!/bin/bash
export TMPDIR="${HOME}/.tmp"
mkdir -p $TMPDIR
FILES=$(ls *.svg | egrep '[0-9]\.')
DPI=400
# inkscape --file=12.svg --export-text-to-path --export-dpi=300 --export-pdf-version=1.5 --export-filename=pdf/12.pdf
for file in $FILES
do
@macbre
macbre / 2019-https-localhost.md
Created April 4, 2020 09:54 — forked from cecilemuller/2019-https-localhost.md
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

@macbre
macbre / nginx-tls.conf
Created April 1, 2020 17:20 — forked from gavinhungry/nginx-tls.conf
Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Name: nginx-tls.conf
# Auth: Gavin Lloyd <gavinhungry@gmail.com>
# Desc: Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Enables HTTP/2, PFS, HSTS and OCSP stapling. Configuration options not related
# to SSL/TLS are omitted here.
#
# Example: https://www.ssllabs.com/ssltest/analyze.html?d=gavinhungry.io
#
@macbre
macbre / .gitignore
Last active August 19, 2020 17:30
mbc-harvester
.idea/
*.swp
env
user-password.py
apicache-py3/
harvest.log
pywikibot.lwp
throttle.ctrl
@macbre
macbre / ntriples.py
Created August 24, 2019 09:45
N-Triples parser
#!/usr/bin/env python
"""
N-Triples Parser
Copyright 2004, Sean B. Palmer, inamidst.com
Licensed under GPL 2, W3C, BSD, MIT, or EFL 2
Documentation:
http://inamidst.com/proj/rdf/ntriples-doc
Command line usage:
./ntriples.py <URI> - parses URI as N-Triples
@macbre
macbre / waterfalls.txt
Created July 30, 2019 22:11
Faroe Islands
$ curl -s 'https://gis.us.fo/arcgis/rest/services/stadarnovn/us_stadarnovn/MapServer/1/query?f=json&where=UPPER(name)%20LIKE%20%27%25FOSSUR%25%27&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=name%2Cobjectid&outSR=5316&resultRecordCount=200' | jq .features[].attributes.name -r | sort
Áarstíggjafossur
Ærgifossur
Ærgisfossur
Ærgisfossur
Bjerndalsfossur
Bláfossur
Bláfossur
Bláfossur
Bláfossur
@macbre
macbre / fetch-youtube.sh
Created June 14, 2019 17:57
Fetch audio from YouTube video
#!/bin/bash
youtube-dl --extract-audio --audio-format mp3 -o "%(title)s.%(ext)s" "$1"