Skip to content

Instantly share code, notes, and snippets.

View anthdm's full-sized avatar

Anthony De Meulemeester anthdm

View GitHub Profile
@anthdm
anthdm / snappy document compress ex.
Created March 20, 2014 14:17
snappy document compress ex.
var fs = require('graceful-fs');
var dbPath = require('../config').dbPath;
var date = require('moment');
var E = require('./qurl_error');
var DS = '/';
var snappy = require('snappy');
module.exports = Document;
function Document () {
@anthdm
anthdm / gist:b80f9272effe3733710b
Last active August 29, 2015 14:02
time intersect
function timeIntersect = function (newD, origin) {
var minTime = Math.max(newD[0], origin[0]);
var maxTime = Math.min(newD[1], origin[1]);
if (minTime < maxTime) {
return [minTime, maxTime];
}
}
@anthdm
anthdm / .ex
Created October 17, 2015 13:48
defmodule Callback.Worker do
use GenServer
require Logger
import HTTPoison
@max_retries 3
def init(state \\ []), do: {:ok, state}
def start_link([]), do: GenServer.start_link(__MODULE__, [], [])
@anthdm
anthdm / stopwords.py
Last active December 17, 2017 09:21
part_2_stopwords
from sklearn.feature_extraction.text import TfidfVectorizer, ENGLISH_STOP_WORDS
stopwords = ENGLISH_STOP_WORDS.union(['ect', 'hou', 'com', 'recipient'])
vec = TfidfVectorizer(analyzer='word', stop_words=stopwords, max_df=0.3, min_df=2)
vec_train = vec.fit_transform(email_df.body)
@anthdm
anthdm / cosine_sim_01.py
Last active December 17, 2017 09:20
cosine_sim_01
from sklearn.metrics.pairwise import linear_kernel
cosine_sim = linear_kernel(vec_train[0:1], vec_train).flatten()
print(cosine_sim)
@anthdm
anthdm / cosine_sim_02.py
Created December 17, 2017 09:25
cosine_sim_02
vec = TfidfVectorizer(analyzer='word', stop_words=stopwords, max_df=0.3, min_df=2)
vec_train = vec.fit_transform(email_df.body)
query = "phillip"
vec_query = vec.transform([query])
cosine_sim = linear_kernel(vec_query, vec_train).flatten()
@anthdm
anthdm / query.py
Last active December 17, 2017 12:01
email_dataset
from sklearn.feature_extraction.text import TfidfVectorizer, ENGLISH_STOP_WORDS
from sklearn.metrics.pairwise import linear_kernel
from helpers import parse_into_emails
import pandas as pd
def read_email_bodies():
emails = pd.read_csv('split_emails.csv')
email_df = pd.DataFrame(parse_into_emails(emails.message))
email_df.drop(email_df.query("body == '' | to == '' | from_ == ''").index, inplace=True)
@anthdm
anthdm / uint256.go
Created February 2, 2018 18:54
Uint256
// Uint256FromHexString returns an Uint256 from an encode hex string.
func Uint256FromHexString(hexStr string) (Uint256, error) {
var val Uint256
b, err := hex.DecodeString(hexStr)
if err != nil {
return val, err
}
return Uint256FromBytes(b)
@anthdm
anthdm / anthdm_30-01_06-02.md
Last active February 6, 2018 07:15
Work on the Golang port for week 30/01 - 06/02

Introduction

As first I want to make a small introduction as I am a newcomer in the CoZ community.

My name is Anthony De Meulemeester, 30 years old and living in Belgium. My current job position is head of technology @ AcademicLabs, a matchmaking platform to bring researchers, scientists and the corporate world closer together. I'm a systems/networking programmer since I was 17. Writing c, c++, python and the past four years also writing Golang.

Why Go?

  • Runs everywhere. No more hassle on windows.
  • Easy to pick up as a language.
  • the community is asking for it.
  • Go suits perfect for distributed systems and low-level systems programming (VM).
@anthdm
anthdm / COZ_contribution_week_#32.md
Last active February 12, 2018 22:56
COZ contribution week #32

NEO-GO

Finished processing headers for the node + implemented leveldb as core storage PR #16

This resulted in a semi working node (processing block needs to be done) that can connect to 1 seed and find its way to others peers.

    _   ____________        __________
   / | / / ____/ __ \      / ____/ __ \
  /  |/ / __/ / / / /_____/ / __/ / / /
 / /|  / /___/ /_/ /_____/ /_/ / /_/ /
/_/ |_/_____/\____/      \____/\____/