Skip to content

Instantly share code, notes, and snippets.

@uncommoncode
uncommoncode / randomized_response.ipynb
Last active June 20, 2016 13:32
Randomized Response Function for Differential Privacy
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@uncommoncode
uncommoncode / randomized_response.py
Created August 9, 2015 06:36
Randomized Response
import random
def randomized_response(true_response):
"""
Return a randomized response giving plausible deniability to a query about our true response value. This allows us to run
queries across a population while preserving individual privacy.
Parameters
---
true_response : boolean
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@uncommoncode
uncommoncode / FloatPacking.frag
Last active December 9, 2020 13:27
Stuff a 3 component vector into a single floating point component.
/*
* The number of bits of precision per color channel are log_2(c_precision),
* in this case 7 bits per color, or 21 bits total.
*
* A c_precision of 128 fits within 7 base-10 digits.
*
* NOTE: an IEEE 754 float can only express 7 digits exactly for all digits.
*/
const float c_precision = 128.0;
const float c_precisionp1 = c_precision + 1.0;
@uncommoncode
uncommoncode / OpenThreadsExample.cpp
Last active August 29, 2015 14:10
Example code for OpenThreads
#include <OpenThreads/Thread>
class Thread : public OpenThreads::Thread
{
public:
Thread() : OpenThreads::Thread()
{
// initializer code here
}
virtual void run()