Skip to content

Instantly share code, notes, and snippets.

@bertm
bertm / DigestBenchmark.java
Last active March 19, 2024 22:04
Microbenchmark for Hyphanet Fred's SHA256 wrapper
package freenet.benchmark;
import java.lang.invoke.MethodHandles;
import java.lang.ref.SoftReference;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.Provider;
import java.util.Queue;
import java.util.Random;
import java.util.concurrent.ConcurrentLinkedQueue;
@bertm
bertm / README.md
Created July 21, 2016 13:59
Python Freenet fetchpull

Insert-and-fetch statistics for Freenet

Disclaimer: this is by all means unfinished work.

This script should be run at most once a day (preferably exactly once a day), and the uid must be unique. It requires a modified pyFreenet with this patch applied.

To run, first edit fetchpull.py to set a unique uid, then:

python2 fetchpull.py
@bertm
bertm / mp3time.sh
Created March 10, 2016 18:00
MP3 stream of spoken time
#!/bin/bash
# Outputs a continuous MP3 stream with spoken current time on stdout.
# Requirements: text2wave (from festival) and ffmpeg (some old version)
# Speak interval. Must be higher than the length of the spoken time.
INTERVAL=5
RATE=48000
TS=$(($(date +%s) + $INTERVAL))
@bertm
bertm / freestream.sh
Last active February 8, 2021 20:02
Freenet M3U8 video stream generator
#!/bin/bash
# This script uses x264 and ffmpeg to recode an input video to low-bitrate MPEG-TS segmented h264
# stream that is suitable for streaming over the web and can be inserted into Freenet.
# Settings have been chosen to strongly prefer quality over encoding speed under conditions of an
# extremely low bitrate, to make the result suitable for direct streaming over Freenet.
#
# (c) bertm, 2014
#
# Prefix for file names in the playlist
@bertm
bertm / vanity.c
Last active November 19, 2017 20:58
Freenet vanity key generator
/*
Link to libcrypto and libgmp. Only tested on a 64 bit machine.
This program may disclose your private key, harm your computer or kill your cat. Use only if you
understand what it does. I accept no responsibility for any use of this program.
*/
#include <openssl/evp.h>
#include <gmp.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
@bertm
bertm / gist:8698abef81a439a8d36b
Last active August 29, 2015 14:01
Plotting link-length distribution
#!/bin/bash
N=`cat linklengths.txt | wc -l`
HTL=25
gnuplot -e "set title 'N = $N, HTL = $HTL'" \
-e "set table 'plot.dat'" \
-e "plot 'linklengths.txt' u 1:(1) smooth cnormal notitle" \
-e "unset table" \
-e "set xrange [1e-5:0.5]" \
-e "set yrange [1e-3:1]" \