Skip to content

Instantly share code, notes, and snippets.

View daniele-athome's full-sized avatar

Daniele Ricci daniele-athome

View GitHub Profile
@daniele-athome
daniele-athome / ConvertPEM.java
Created June 8, 2015 23:50
SSL: Error parsing certificate
import java.io.*;
import java.security.cert.*;
import org.bouncycastle.openssl.*;
public class ConvertPEM {
public static void main(String[] args) throws Exception {
@daniele-athome
daniele-athome / convert-messages.py
Last active May 10, 2017 13:08
Convert a Kontalk legacy conversation to HTML
#!/usr/bin/env python
# Convert a Kontalk legacy conversation to HTML
# Usage: ./convert-messages.py messages.db phone_number [display_name]
# HTML goes to standard output
import sys
import hashlib
import sqlite3
from datetime import datetime
@daniele-athome
daniele-athome / oneliner.sh
Created February 19, 2019 17:03
Sort mounts by used space
df -h |head -1; df -h | tail +2 | sort -t " " -h -k 5
@daniele-athome
daniele-athome / LimitedInputStream.java
Created August 5, 2021 12:33
InputStream that reads up to a given size
import java.io.*;
public class LimitedInputStream extends InputStream {
private final InputStream stream;
private final long limit;
private long bytesRead;
public LimitedInputStream(InputStream stream, long limit) {
this.stream = stream;
this.limit = limit;
#!/bin/sh
git reflog expire --expire=now --all
git gc --prune=all --aggressive
FROM ubuntu:20.04
ARG ESSENTIA_VERSION=2.1_beta5
ENV LANG C.UTF-8
RUN apt-get update \
&& apt-get -y upgrade \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
python3-matplotlib python3-numpy python3-six python3-yaml \
libfftw3-3 libyaml-0-2 libtag1v5 libsamplerate0 \
@daniele-athome
daniele-athome / convert-threads.py
Last active September 2, 2022 07:55
Convert a Kontalk database (v4) to HTML files
#!/usr/bin/env python3
# Convert a Kontalk conversation to HTML
# Usage: ./convert-threads.py messages.db
# HTML goes to files in current directory, one per thread
import sys
import hashlib
import sqlite3
from datetime import datetime
@daniele-athome
daniele-athome / web-servers.md
Created August 11, 2023 07:34 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@daniele-athome
daniele-athome / sync-albums.sh
Last active March 23, 2024 12:24
Synchronize library folder structure with immich albums
#!/usr/bin/env bash
# Synchronize library folder structure with immich albums
# Usage: ./sync-albums.sh http://immich-host:port/api <api-key> <library-path>
set -e
BASE_URL="$1"
API_KEY="$2"
LIBRARY_PATH="${3%/}/"