Skip to content

Instantly share code, notes, and snippets.

View henriklied's full-sized avatar

Henrik Lied henriklied

View GitHub Profile
@henriklied
henriklied / json2geojson.py
Created February 1, 2022 12:06
Quick script to convert an unnested json file with points to a valid geojson file
#!/usr/bin/env python
import json
import argparse
def parse_json(f):
geojson = {}
features = []
geojson['type'] = 'FeatureCollection'
j = json.load(open(f))
geo_keys = {}
from math import sqrt, pow, sin, cos
from math import pi as M_PI
M_PI_2 = M_PI * 2
'''
original c code:
https://raw.githubusercontent.com/warrenm/AHEasing/master/AHEasing/easing.c
Copyright (c) 2011, Auerhaus Development, LLC
http://sam.zoy.org/wtfpl/COPYING for more details.
'''
@henriklied
henriklied / exif_clean.py
Created November 17, 2020 12:46
Strip Exif data from png and jpg files
#!/usr/bin/env python3
from PIL import Image
import os, sys, glob
cwd = os.getcwd()
if len(sys.argv) > 1:
cwd = sys.argv[1]
files = glob.glob(os.path.join(cwd, '*.jpg'))
files.extend(glob.glob(os.path.join(cwd, '*.png')))
#!/bin/bash
capture_file=$(mktemp /tmp/capture.XXX)
keylog_file=$(mktemp /tmp/keylog.XXX)
capture_filter="port 443 or port 80 or port 8883"
add_firewall_rules () {
echo "Setting up firewall rules"
iptables -t nat -A PREROUTING -i wg0 -p tcp --dport 80 -j REDIRECT --to-port 8080
require "formula"
class Cubicsdr < Formula
homepage "https://github.com/cjcliffe/CubicSDR"
url "https://github.com/cjcliffe/CubicSDR/archive/0.2.3.tar.gz"
sha256 "b058883a82c466530000ec15aa6c7f690036efb0374ca4da87da441fbd2043cf"
head "https://github.com/cjcliffe/CubicSDR.git"
depends_on "cmake" => :build
require "formula"
class Cubicsdr < Formula
homepage "https://github.com/cjcliffe/CubicSDR"
url "https://github.com/cjcliffe/CubicSDR/archive/0.2.3.tar.gz"
sha256 "b058883a82c466530000ec15aa6c7f690036efb0374ca4da87da441fbd2043cf"
head "https://github.com/cjcliffe/CubicSDR.git"
depends_on "cmake" => :build
import time, os
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
GPIO.setup(10, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
is_pushed = False
def button_callback(channel):
global is_pushed

Keybase proof

I hereby claim:

  • I am henriklied on github.
  • I am henriklied (https://keybase.io/henriklied) on keybase.
  • I have a public key whose fingerprint is 62F2 87D3 8FA8 21DC D596 8D2C 43D4 593C BFD9 8623

To claim this, I am signing this object:

<?php
$comma_string = 'this,is,a,comma,string,with,some,content';
$exploded = explode(',', $comma_string);
$multi_array = array();
while($exploded) {
$multi_array[array_shift($exploded)] = array_shift($exploded);
}
var_dump($multi_array);
1
00:00:18,000 --> 00:00:25,000
My Name is Angela Morelli and I graduated last year at Central St. Martins in London with an MA in communication design.
2
00:00:25,000 --> 00:00:37,000
I specialize in information design and my last self-initiated project is called the global water-footprint of humanity.
3
00:00:38,000 --> 00:00:48,000