Skip to content

Instantly share code, notes, and snippets.

View AndyNovo's full-sized avatar

Andy Novocin AndyNovo

View GitHub Profile
#include <iostream>
#include <set>
#include <algorithm>
#include <iterator>
using namespace std;
int main()
{
/* type of the collection:
* - no duplicates
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main()
{
/* type of the container:
* - map: elements key/value pairs
* - string: keys have type string
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main()
{
// type of the collection
typedef multimap<int,string> IntStringMMap;
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> coll; // vector container for integer elements
// append elements with values 1 to 6
for (int i=1; i<=6; ++i) {
@AndyNovo
AndyNovo / input.txt
Created September 14, 2016 16:03
Another input file
12-2-8-5 25-22-19-18 22-6 25-22-24-18 14 19-14-5-26 12-2-8-5 15-5-14-22-1 25-22-24-18 6-2-22-25 22-19 12-2-8 3-25-14-1-7 3-2-22-6-2-1-2-8-6 1-22-20-21-7-6-21-14-17-18 7-21-18-1 12-2-8 10-22-25-25 20-5-2-10 1-22-20-21-7-6-21-14-17-18 22-19 12-2-8 3-25-14-1-7 19-5-8-22-7 12-2-8 10-22-25-25 20-5-2-10 19-5-8-22-7 7-21-18 7-21-2-8-20-21-7-6 12-2-8 3-25-14-1-7 22-1 12-2-8-5 26-22-1-17 18-9-18-5-12-17-14-12 15-18-16-2-26-18 7-21-18 16-5-2-3 12-2-8-5 25-22-19-18 12-22-18-25-17-6
@AndyNovo
AndyNovo / input.txt
Created September 14, 2016 15:54
Input File
7-21-22-6 22-6 18-1-16-2-17-18-17 10-22-7-21 14 16-14-18-6-14-5 16-22-3-21-18-5
B0 = Matrix(GF(3), 5, 5)
B1 = Matrix(GF(3), 5, 5)
B2 = Matrix(GF(3), 5, 5)
B0[1,0] = 1
B0[4,1] = 1
B1[0,0] = -1
B1[1,1] = -1
B1[2,2] = 1
B1[3,1] = -1
B1[4,2] = -1
header = ("01000000" +
"81cd02ab7e569e8bcd9317e2fe99f2de44d49ab2b8851ba4a308000000000000" +
"e320b6c2fffc8d750423db8b1eb942ae710e951ed797f7affc8892b0f1fc122b" +
"c7f5d74d" +
"f2b9441a" +
"42a14695")
hashlib.sha256(hashlib.sha256(binascii.unhexlify(header)).digest()).digest()
header = ("01000000" +
"81cd02ab7e569e8bcd9317e2fe99f2de44d49ab2b8851ba4a308000000000000" +
"e320b6c2fffc8d750423db8b1eb942ae710e951ed797f7affc8892b0f1fc122b" +
"c7f5d74d" +
"f2b9441a" +
"42a14695")
print hashlib.sha256(hashlib.sha256(binascii.unhexlify(header)).digest()).digest()
@AndyNovo
AndyNovo / interpolate.sagews
Created May 15, 2016 22:06
Polynomial Interpolation in SAGE
p=11
R.<x>=PolynomialRing(GF(p))
points=[(1,1), (3,3)]
f=R.lagrange_polynomial(points)