Skip to content

Instantly share code, notes, and snippets.

Avatar

Filippo Valsorda FiloSottile

View GitHub Profile
@Sc00bz
Sc00bz / cpace.txt
Created Jan 21, 2020
CPace is a balanced PAKE
View cpace.txt
CPace
CPace is the best balanced PAKE that I know of.
Costs per step
A: - fH**[ii]
B: H*i f*i
-: Negligible work
*: Scalar point multiply
@jvehent
jvehent / age demo.md
Created Jan 6, 2020
age-encryption.org demo
View age demo.md

Download & install

$ wget https://github.com/FiloSottile/age/releases/download/v1.0.0-beta2/age-v1.0.0-beta2-linux-amd64.tar.gz
$ 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
htr3n / macos-ramdisk.md
Last active Jul 27, 2021
Creating RAM disk in macOS
View macos-ramdisk.md

Built-in

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.

Notes:

@pedrovgp
pedrovgp / fetch_stock_prices_for_gnucash.py
Last active Mar 29, 2021
Python script to fetch stock prices for gnucash using http://alphavantage.co/ api. Since Quotes::Finance fetching from Yahoo finance no longer works, it is an alternative.
View fetch_stock_prices_for_gnucash.py
# 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
@rkrzr
rkrzr / auto_tags.py
Last active May 19, 2021
Automatically generate ansible tags of the same name for each role in a playbook
View auto_tags.py
"""
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
mimoo / curve25519.sage
Created Nov 16, 2017
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
@contra
contra / aoe2hd.md
Last active Aug 3, 2021
Age of Empires II HD - For Mac OSX
View aoe2hd.md
@hdevalence
hdevalence / gist:aac098857248a1c3134eb8101b692547
Created Oct 30, 2016
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'))
@joepie91
joepie91 / vpn.md
Last active Aug 2, 2021
Don't use VPN services.
View vpn.md

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.
@cknave
cknave / caenons3.md
Created Mar 21, 2015
Camlistore Encryption on S3
View caenons3.md

Camlistore Encryption on S3

Here's what I found out while setting up Camlistore to sync encrypted blobs to Amazon S3. This works for me, but I'm new to Camlistore so this might not be the best way to do it.

Amazon S3 Config

The encryption handler requires two buckets, one for metadata and one for blobs. In this example, I've created two buckets called my-camlistore-meta and my-camlistore-blob.