Skip to content

Instantly share code, notes, and snippets.

View Tombert's full-sized avatar

Thomas Gebert Tombert

View GitHub Profile
(ns homomorph.core
(:gen-class))
(import java.security.SecureRandom)
(defn lcm [a b] (.divide (.multiply a b) (.gcd a b)))
(defn makePublicKey [bits nn]
(let [n (biginteger nn)]
{
:bits (biginteger bits)
:n n
:n2 (.pow n 2)
genomeTypes =
Dict(
[0,0,0,1] => "1",
[0,0,1,0] => "2",
[0,0,1,1] => "3",
[0,1,0,0] => "4",
[0,1,0,1] => "5",
[0,1,1,0] => "6",
@Tombert
Tombert / APIDraft
Created March 7, 2016 05:18
Hello!
This is a basic draft of the API right now.
`GET /events`
[{
"name": "Tombert's Cool Event",
"id":1,
"data":"{
\"date\":\"12-15-2016\",
\"description\":\" Where tomberts come to grow \"
@Tombert
Tombert / randcat.py
Last active February 3, 2016 22:28
RandCat
#! /usr/bin/python3
import calendar
import time
seed = calendar.timegm(time.gmtime()) # We'll use the epoch time as a seed.
def random (seed):
seed2 = (seed*297642 + 83782)/70000
return int(seed2) % 70000;
require 'digest/md5'
def hashKey(key)
md5 = Digest::MD5.hexdigest("bobby"
int_md5 = md5.to_i(16)
return int_md5 % max_length
end
@Tombert
Tombert / nginx.conf
Created August 28, 2015 15:48
nginx stuf
server {
listen 80;
server_name brucewillis.sexy;
return 301 https://www.brucewillis.sexy$request_uri;
}
server {
listen 443 ssl;
server_name brucewillis.sexy www.brucewillis.sexy;
@Tombert
Tombert / server.c
Created July 17, 2015 22:57
basicserver.c
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/ip.h> /* superset of previous */
int main( int argc, char **argv){
int tcp_socket;
==> cowboy (compile)
Compiled src/cowboy_acceptors_sup.erl
Compiling src/cowboy_listener.erl failed:
src/cowboy_listener.erl:30: type queue/0 is deprecated and will be removed in OTP 18.0; use use queue:queue/0 or preferably queue:queue/1
src/cowboy_listener.erl:211: type queue/0 is deprecated and will be removed in OTP 18.0; use use queue:queue/0 or preferably queue:queue/1
src/cowboy_listener.erl:211: type queue/0 is deprecated and will be removed in OTP 18.0; use use queue:queue/0 or preferably queue:queue/1
Could not compile dependency cowboy, /usr/bin/rebar command failed. If you want to recompile this dependency, please run: mix deps.compile cowboy
@Tombert
Tombert / rc.lua
Last active August 29, 2015 14:22
My AwesomeWM config
-- Standard awesome library
local gears = require("gears")
local awful = require("awful")
awful.rules = require("awful.rules")
require("awful.autofocus")
-- Widget and layout library
local wibox = require("wibox")
-- Theme handling library
local beautiful = require("beautiful")
-- Notification library
@Tombert
Tombert / testing
Created January 21, 2015 20:26
Title4
<p>A generalization for all even numbers is <br>
<span class="MathJax_Preview"></span><div class="MathJax_Display" role="textbox" aria-readonly="true" style="text-align: center;"><span class="MathJax" id="MathJax-Element-1-Frame"><nobr><span class="math" id="MathJax-Span-1" style="width: 1.143em; display: inline-block;"><span style="display: inline-block; position: relative; width: 0.995em; height: 0px; font-size: 112%;"><span style="position: absolute; clip: rect(1.639em 1000.002em 2.631em -0.394em); top: -2.478em; left: 0.002em;"><span class="mrow" id="MathJax-Span-2"><span class="mn" id="MathJax-Span-3" style="font-family: STIXGeneral-Regular;">2</span><span class="mi" id="MathJax-Span-4" style="font-family: STIXGeneral-Italic;">k<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.002em;"></span></span></span><span style="display: inline-block; width: 0px; height: 2.483em;"></span></span></span><span style="border-left-width: 0.003em; border-left-style: solid; display: inline-block