Skip to content

Instantly share code, notes, and snippets.

Avatar
🤓

Milo Wielondek mwielondek

🤓
View GitHub Profile
@mwielondek
mwielondek / at2r.py
Created Sep 24, 2020
Transform csv-export from Airtable onto Roam readable format with proper indentation
View at2r.py
#!/usr/bin/env python3
# For transforming export from Airtable to Roam
import sys, re
filename = sys.argv[1]
filename_out = sys.argv[2]
with open(filename, 'r') as my_file:
str = my_file.read()
@mwielondek
mwielondek / ThingsStats.scpt
Last active Mar 26, 2017
Javascript for Automation (JXA) task to compute what percentage of completed tasks fall into which Area in Cultured Code's Things
View ThingsStats.scpt
// how many days to go back
var dayDiff = 21;
var d = new Date();
d.setDate(d.getDate() - dayDiff);
var things = Application('Things');
var logbook = things.lists[6].toDos;
var counter = {};
@mwielondek
mwielondek / openurls.sh
Last active Jan 17, 2016
Reads (max 6) urls from text files in a given directory and opens them in Safari
View openurls.sh
cat * | head -n 6 | xargs open -a 'Safari'
@mwielondek
mwielondek / websocketserver.py
Last active Aug 20, 2019 — forked from jkp/websocketserver.py
Simple WebSocket server. Can be run independently or as a module import.
View websocketserver.py
import struct
import SocketServer
import sys
from base64 import b64encode
from hashlib import sha1
from mimetools import Message
from StringIO import StringIO
DEFAULT_PORT = 9999
@mwielondek
mwielondek / capitalize.sh
Last active Aug 29, 2015
Shell function for capitalizing filenames. Accepts multiple args.
View capitalize.sh
# usage: `capitalize foo.txt bar.log` will rename files foo.txt bar.log => Foo.txt Bar.log
function capitalize() { for i; do echo $i | gsed -r 's/\w/\u&/' | xargs mv $i; done }
@mwielondek
mwielondek / diagtravmat.py
Last active Aug 29, 2015
A function for diagonal matrix traversal. (python3)
View diagtravmat.py
def diag_trav_mat(mat,func):
# pretend to be working with a square matrix
# extend length to the largest of the sides
n = max(len(mat),len(mat[0]))
# for the amount of diagnoals
for x in range(0, 2*n-1):
# num of elements in diagonal
el = n - abs(n-1-x)