Skip to content

Instantly share code, notes, and snippets.

@fidelthomet
fidelthomet / canvas.md
Last active November 1, 2022 16:26
The Art of the Baniwa Women

pottery graph

@fidelthomet
fidelthomet / atToAndFrom$.js
Created October 20, 2021 10:00
@-signs in javascript object keys are tedious to work with as they can't be accessed through dot notation or unpacked using the destructuring assignment. Yet @ is used in formats like JSON-LD. This script contains two methods to recursively replace @ with $ at the start of object keys.
function atTo$(data) {
if (Array.isArray(data)) {
return data.map(d => atTo$(d))
} else if (typeof data === 'object' && data != null) {
return Object.fromEntries(Object.entries(data).map(d => {
d[0] = d[0].replace(/^@/, '$')
return atTo$(d)
}))
}
return data
@fidelthomet
fidelthomet / pdf-merge.py
Created May 19, 2020 14:01
python3 script to merge pdf files with option to skip first or last page, based on https://stackoverflow.com/a/3444735
from argparse import ArgumentParser
from glob import glob
from PyPDF2 import PdfFileReader, PdfFileWriter
def PDF_cat(files, output_filename, skipfirstpage, skiplastpage):
# First open all the files, then produce the output file, and
# finally close the input files. This is necessary because
# the data isn't read from the input files until the write
@fidelthomet
fidelthomet / offsettimestamp.sh
Created August 2, 2019 13:14
batch offset timestamps in photos
#!/bin/bash
for f in DP2Q*.*; do
ts="$(GetFileInfo -d "$f")"
e="$(date -j -f "%m/%d/%Y %H:%M:%S" "$ts" +%s)"
((o=60*60*24*60-27120))
((e+=o))
nd="$(date -r $e "+%m/%d/%Y %H:%M:%S")"
SetFile -m "$nd" "$f"
SetFile -d "$nd" "$f"
done
@fidelthomet
fidelthomet / README.md
Created November 20, 2018 19:12 — forked from bricedev/README.md
NYC Weather 2014

A d3js implementation of weather radials infographics. Data from WU.

The temperatures are represented by bars and the precipitations by circles.

@fidelthomet
fidelthomet / .block
Last active March 15, 2017 15:33 — forked from armollica/.block
Proj4/WKT + D3
height: 600
Jahr Herkunft Anzahl
1901 Schweizerinnen und Schweizer 108291
1901 Ausländerinnen und Ausländer 42010
1902 Schweizerinnen und Schweizer 110707
1902 Ausländerinnen und Ausländer 43034
1903 Schweizerinnen und Schweizer 112915
1903 Ausländerinnen und Ausländer 45804
1904 Schweizerinnen und Schweizer 115612
1904 Ausländerinnen und Ausländer 48448
1905 Schweizerinnen und Schweizer 117236
@fidelthomet
fidelthomet / index.html
Last active February 16, 2016 10:37
Kanton Zürich - Aerial Imagery
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>
<style type="text/css">
#map { height: 400px; }
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>
<style type="text/css">
#map { height: 400px; }