Skip to content

Instantly share code, notes, and snippets.

@pradn
pradn / simulation.py
Created November 18, 2018 03:44
Procedural modelling classical Chinese visions of political order
# based on a problem posted in a SO question: https://stackoverflow.com/questions/53236513/procedural-modelling-classical-chinese-visions-of-political-order
import random
NUM_PEOPLE = 5
ROUNDS = 10
GENEROSITY_MIN = 0.01
GENEROSITY_MAX = 0.10
@yzh119
yzh119 / st-gumbel.py
Created January 12, 2018 12:25
ST-Gumbel-Softmax-Pytorch
from __future__ import print_function
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
def sample_gumbel(shape, eps=1e-20):
U = torch.rand(shape).cuda()
return -Variable(torch.log(-torch.log(U + eps) + eps))
@borgfriend
borgfriend / maya2017install.sh
Last active April 13, 2024 13:34
Maya 2017 Installation on Ubuntu 16.04
#!/bin/bash
#Make sure we’re running with root permissions.
if [ `whoami` != root ]; then
echo Please run this script using sudo
echo Just type “sudo !!
exit
fi
#Check for 64-bit arch
if [uname -m != x86_64]; then
@jansegre
jansegre / script.lua
Last active February 10, 2020 23:48
Very basic luajit from Rust.
-- script.lua
-- Receives a table, returns the sum of its components.
io.write("The table the script received has:\n");
x = 0
for i = 1, #foo do
print(i, foo[i])
x = x + foo[i]
end
io.write("Returning data back to C\n");
return x
/*
-----------------------------------
Emoji - natural display for the web
-----------------------------------
These font face definitions allows to display emoji glyphs intermingled with
arbitrary characters outside emoji unicode blocks.
Usage
@karlgluck
karlgluck / Hash Ladders for Shorter Lamport Signatures.md
Last active May 10, 2025 01:59
I describe a method for making Lamport signatures take up less space. I haven't seen anyone use hash chains this way before, so I think it's pretty cool.

What's this all about?

Digital cryptography! This is a subject I've been interested in since taking a class with Prof. Fred Schneider back in college. Articles pop up on Hacker News fairly often that pique my interest and this technique is the result of one of them.

Specifically, this is about Lamport signatures. There are many signature algorithms (ECDSA and RSA are the most commonly used) but Lamport signatures are unique because they are formed using a hash function. Many cryptographers believe that this makes them resistant to attacks made possible by quantum computers.

How does a Lamport Signature work?

@lebedov
lebedov / freq_shift_ssb.py
Last active April 10, 2023 20:37
Frequency shift a signal using SSB modulation.
#!/usr/bin/env python
"""
Frequency shift a signal using SSB modulation.
"""
import numpy as np
import scipy as sp
import scipy.signal
import matplotlib.pyplot as plt