Skip to content

Instantly share code, notes, and snippets.

@PirosB3
PirosB3 / gist:ab7815fe5db951715aba7b0983a9ada7
Created September 27, 2016 07:54
My first raw transaction
{
"txid": "c15083d9593abad0e0ee35afa12ae7463497d34de0bc9a51e86b16634b5e9779",
"version": 1,
"locktime": 0,
"vin": [
{
"txid": "592928d43a21294fce7592edac21060aa47cc22d9c368c544cdcdb8ef178900c",
"vout": 0,
"scriptSig": {
"asm": "304402200e5ea2c9944770d5f823316565a7a1bd1131caeb203c827b47aa5d14596f80c502203e2fd2b99b39127d6f0cc5f30791048f890e2fe03cdc5d0c10e4b542b7ff8d0f01 036613cf1e844edde97f89468ce453bb609d3270a986ca9fbb6dd29d90773bf67e",
@PirosB3
PirosB3 / hexagon.md
Created June 22, 2016 00:23
hexagon.md

Hexagon: building a graph database on top of a key-value store

I've always been interested in how information is stored and retrieved. Inspired by a project of a friend (Levelgraph), I decided to research more about Hexastores and how they can be adapted to modern NoSQL databases such as LevelDB and Cassandra. Out of this fascination and curiosity I created Hexagon: a simple Python implementation of Hexastores backed by LevelDB.

In this talk I plan on giving a very simple and hands-on introduction to the subject, followed by a demonstration of how Python really allowed me to focus on the implementation thanks to its extremely intuitive syntax and features. I will show how generators, collections, and Test Driven Development allowed me to iterate fast and not get lost in (too many) bugs along the way.

The talk will start with an overview of what Hexagon is and the reason why I built it. The second step will consist in the explanation of the two main concepts behind Hexagon itself, namely LevelDB and the

my_request = flask.make_response('asd', 200, {'Authorization': 'bearer xxxxxxx'})
package main
import (
cryptorand "crypto/rand"
"math/rand"
"errors"
"sync"
"fmt"
"time"
)
1 0 0 0
0 1 0 0
0 0 1 1/f
0 0 0 0
[{"id":35,"user_id":36,"video_path":"6cc56475885fbdb83a536d78b16e1e0c/h264/play.mp4","description":null,"thumbnail_path":"6cc56475885fbdb83a536d78b16e1e0c/h264/play_1.jpg","created_at":"2014-01-14T21:47:10.137+01:00","updated_at":"2014-01-14T21:47:25.101+01:00","title":"jj","panda_video_id":"6cc56475885fbdb83a536d78b16e1e0c","panda_status":"complete","width":640,"height":480,"type":"video","video_url":"http://tascout.s3.amazonaws.com/6cc56475885fbdb83a536d78b16e1e0c/h264/play.mp4","thumbnail_url":"http://tascout.s3.amazonaws.com/6cc56475885fbdb83a536d78b16e1e0c/h264/play_1.jpg","likes":[],"comments":[{"id":62,"user_id":36,"user_name":"Daniel Pyrathon","profile_image_url":"http://graph.facebook.com/665044728/picture?type=large","body":"fuck off"},{"id":61,"user_id":36,"user_name":"Daniel Pyrathon","profile_image_url":"http://graph.facebook.com/665044728/picture?type=large","body":"fuck off"},{"id":60,"user_id":36,"user_name":"Daniel Pyrathon","profile_image_url":"http://graph.facebook.com/665044728/picture?ty
@PirosB3
PirosB3 / gist:8047662
Last active December 31, 2015 21:29
LoadMesh function
SortOfMeshSubset *LoadMesh(LPSTR filename) {
std::wifstream fileStream;
std::wstring line;
// Instead of using VertexXYZ I am just using XMFLOAT3 and XMFLOAT2
std::vector <XMFLOAT3> vectorVertices(0);
std::vector <XMFLOAT2> vectorTextureVertices(0);
std::vector <XMFLOAT3> vectorNormalVertices(0);
std::vector<SimpleVertex> vertices;
@PirosB3
PirosB3 / gist:7895888
Created December 10, 2013 18:46
CUDA
#include <math.h>
#define WARP_SIZE 16
#define DEBUG false
/* ---------------- [[CUDA KERNELS]] ---------------- */
__global__ void updateWeightsCUDA(float *weights, float *changes, float *delta_outputs, float *inputs, int n_inputs, int n_outputs) {
int width = n_outputs;
int height = n_inputs;
import datetime
import json
import os
import time
import pymongo
from flask import Flask, render_template
from pymongo.uri_parser import parse_uri
@PirosB3
PirosB3 / gist:7530728
Created November 18, 2013 16:23
MNIST
import argparse
from collections import defaultdict
import cPickle, gzip
import multiprocessing
import sys
import Image
import numpy as np
from sklearn.datasets import fetch_mldata