Skip to content

Instantly share code, notes, and snippets.

View veniversum's full-sized avatar
🛰️
In space

veniversum

🛰️
In space
View GitHub Profile
--- a/src/edu/caltech/nanodb/expressions/TupleComparator.java
+++ b/src/edu/caltech/nanodb/expressions/TupleComparator.java
@@ -44,7 +44,7 @@ public class TupleComparator implements Comparator<Tuple> {
/** The epsilon used to compare floating-point values. */
- private static double EPSILON = 0.00000;
+ private static final double EPSILON = 0.00001;
import java.util.Scanner;
public class Terror {
public static void main(String[] args) {
/*
Example input with 30 trains
30
11 15 16 17 24 31 42 44 45 54 57 77 79 90 92 96 102 104 110 120 123 129 131 134 150 151 153 178 192 193
*/
Scanner sc = new Scanner(System.in);
import subprocess
import re
import numpy as np
p = re.compile(b'Found model for sentence in ([0-9]+) flips')
maxFlips = 600
for i in range(1,11):
for j in np.arange(0,1.1,0.5):
flips = []
for t in range(5):
output = subprocess.check_output(["Main/WalkSat", 'Sat-test/Sat{:02d}.cnf'.format(i), str(j), str(maxFlips)], stderr=subprocess.STDOUT)
@veniversum
veniversum / keybase.md
Last active May 25, 2016 15:20
Keybase proof

Keybase proof

I hereby claim:

  • I am veniversum on github.
  • I am veniversum (https://keybase.io/veniversum) on keybase.
  • I have a public key whose fingerprint is 4F93 F45F D3E2 F156 9092 FE6A 04C6 6EBB 60C4 7CF8

To claim this, I am signing this object:

import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Scanner;
public class RevengeofthePancakes {
public static void main(String[] args) throws IOException {
Scanner scanner = new Scanner(new FileReader("smallB.in"));
PrintStream out = new PrintStream(new FileOutputStream("B.out"));
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintStream;
import java.math.BigInteger;
import java.util.Scanner;
public class CoinJam {
public static void main(String[] args) throws IOException {
Scanner scanner = new Scanner(new FileReader("smallC.in"));
240 400 20 144612 200
1000
73 40 84 107 52 36 13 74 36 94 93 46 123 24 100 93 62 49 97 102 80 37 22 25 72 48 40 74 32 31 136 64 99 37 44 36 104 74 112 40 65 67 50 143 23 26 91 20 142 128 9 77 40 26 55 104 59 112 42 69 87 89 2 11 105 43 105 23 21 88 57 40 52 63 35 141 54 27 45 37 21 37 102 38 36 117 57 93 24 52 83 133 51 102 34 52 39 54 64 146 127 100 58 50 49 40 55 123 64 30 127 63 19 59 31 22 68 37 107 68 52 61 35 38 76 44 21 144 21 40 105 48 97 70 74 95 75 28 25 40 81 72 58 99 52 5 72 84 53 21 110 97 30 43 92 109 39 89 51 30 102 94 13 45 93 94 90 104 36 55 92 12 45 126 73 132 118 127 125 26 83 69 49 39 4 63 84 47 75 43 82 43 51 28 118 110 42 2 53 74 54 57 92 23 72 95 76 35 38 100 52 34 58 74 86 25 32 61 39 55 76 68 107 82 97 108 57 38 88 71 22 40 63 37 80 51 52 52 67 101 49 46 100 52 63 36 53 45 51 56 71 50 13 29 18 36 87 86 39 11 148 74 74 121 11 28 65 79 32 85 95 26 43 123 81 78 25 100 27 90 53 60 100 25 72 80 83 40 62 53 40 97 105 56 49 100 36 46 80 8 23 58 78 58 24 78 67 62 85 80 39 34 62 33 58 130 41 3
import java.io.File;
import java.io.FileNotFoundException;
import java.util.*;
import java.util.stream.Collectors;
public class Hashcode {
public static final String CASE = "mother_of_all_warehouses";
public static int[][] grid; //[x][y], x is Row, y is Column
public static int[] product_weights;
public static Warehouse[] warehouses;
@veniversum
veniversum / encode.py
Created December 15, 2015 20:11
Pass message by flipping single bit in a random message
import random
#CONST
BITMASK = [0b101111100000111111111100000000001111111111000000000011111000001,
0b110111101111000011111100001111110000001111000000111100001000010,
0b111011110111011100011101110001110001110001000111000100010000100,
0b111101111011101101100110110110010110010010011001001000100001000,
0b111110111101110110101011011010101010100100101010010001000010000,
0b111111011110111011010011101101001101001000110100100010000100000]