Skip to content

Instantly share code, notes, and snippets.


Filippo Valsorda FiloSottile

View GitHub Profile
othyn /
Last active May 26, 2023 18:12
Fix horrendously bad macOS (12.3.1 tested) SMB (Samba) performance on Unraid


Out of the box, my SMB performance on macOS 12.3.1 would top out at around 20MB/s in short ~5 second bursts, which was absolutely horrendous, slow to navigate in Finder and slugish to interact with.

Since making these changes, I now get sustained ~80-100MB/s+ and instant Finder navigation which is superb and how things should be out-of-the-box (OOTB)!

May 2023 update: As of Ventura, the SMB issues were just horribly inconsistent and hard to maintain. Something in the combination of Unraid, macOS and SMB just doesn't play nice. I ended up binning NFS/SMB all together and heading to a locally hosted Nextcloud instance for file syncing, then using SFTP/Ansible Git flow for editing files within appdata.


Sc00bz / cpace.txt
Last active October 8, 2021 17:20
CPace is a balanced PAKE
View cpace.txt
CPace is the best balanced PAKE that I know of. CPace defined on multiplicative
groups can be found here:
Costs per step
A: - fH**[ii]
B: H*i f*i
jvehent / age
Created January 6, 2020 15:53 demo
View age

Download & install

$ wget
$ tar -xzvf age-v1.0.0-beta2-linux-amd64.tar.gz
$ sudo cp age/* /usr/local/bin/

Generate a keypair

$ age-keygen -o ~/.age/(date +%s)-(hostname).key
htr3n /
Last active May 31, 2023 16:58
Creating RAM disk in macOS


diskutil erasevolume HFS+ 'RAM Disk' `hdiutil attach -nobrowse -nomount ram://XXXXX`

where XXXXX is the size of the RAM disk in terms of memory blocks.


pedrovgp /
Last active March 29, 2021 14:50
Python script to fetch stock prices for gnucash using api. Since Quotes::Finance fetching from Yahoo finance no longer works, it is an alternative.
# INSTALL DEPENDENCIES BEFORE RUNNING: pandas, sqlite3, sqlalchemy, requests
# There is one thing you have to do though: gnucash needs to know the price's currency and it needs a guid (unique identifier)
# for this. This guid is unique for each installation, so you need to find yours and assign it to CURRENCY_GUID.
# OR: you can just leave it, and the script will fetch the currency from the last price added
import pandas as pd
import sqlite3
import sqlalchemy
from sqlalchemy import create_engine
import datetime
frontdevops / darkthemeswitcher-inline.js
Last active December 20, 2022 12:51
Simple Dark Theme Bookmarklet for web pages
View darkthemeswitcher-inline.js
javascript:(d=>{var css=`:root{background-color:#fefefe;filter:invert(100%)}*{background-color:inherit}img:not([src*=".svg"]),video{filter: invert(100%)}`,style,id="dark-theme-snippet",ee=d.getElementById(id);if(null!=ee)ee.parentNode.removeChild(ee);else {style = d.createElement('style');style.type="text/css";;if(style.styleSheet)style.styleSheet.cssText=css;else style.appendChild(d.createTextNode(css));(d.head||d.querySelector('head')).appendChild(style)}})(document)
rkrzr /
Last active May 12, 2023 09:50
Automatically generate ansible tags of the same name for each role in a playbook
This module implements an Ansible plugin that is triggered at the start of a playbook.
The plugin dynamically generates a tag for each role. Each tag has the same name as its role.
The advantage of this is that it saves you some boilerplate, because you don't have to wrap
all tasks of a role in an additional block and assign a tag to that.
Additionally, it works automatically when you add new roles to your playbook.
Usage is exactly the same as without this plugin:
mimoo / curve25519.sage
Created November 16, 2017 13:21
Curve25519 with sage
View curve25519.sage
# create curve
ec = EllipticCurve(GF(2**255-19), [0,486662,0,1,0])
base_point = ec.lift_x(9)
point_at_infinity = ec(0)
# all elements of order 4
G4s = ec.lift_x(1, True)
G4 = ec.lift_x(1) # just the first element
# the element of order 2
yocontra /
Last active November 28, 2022 04:31
Age of Empires II HD - For Mac OSX
hdevalence / gist:aac098857248a1c3134eb8101b692547
Created October 30, 2016 17:13
convert sage integers to little endian byte strings
View gist:aac098857248a1c3134eb8101b692547
# v--- endianness issues here
bytestr_to_arr = lambda s:"[" + ", ".join(['0x'+b+a for a,b in zip(s[0::2], s[1::2])]) + "]"
ZZtobytestr = lambda x: "".join(ZZ(x).digits(16, '0123456789abcdef'))