Skip to content

Instantly share code, notes, and snippets.

View laurentsenta's full-sized avatar
🌱

Laurent Senta laurentsenta

🌱
View GitHub Profile
@laurentsenta
laurentsenta / d3.js.html
Last active December 15, 2015 12:38
Minimal scripts to get started with some libraries/tools
<!DOCTYPE html>
<html>
<head>
<!-- source: http://christopheviau.com/d3_tutorial/ -->
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
</head>
<body>
<div id="viz"></div>
<script type="text/javascript">
@laurentsenta
laurentsenta / github-repos-dump.sh
Created June 11, 2013 22:03
Clone all the repos!
# June 11, 2013 - Github API v3
# Change LOGIN in the url vvvvv
curl -i https://api.github.com/users/LOGIN/repos | grep '"ssh_url": ' | sed 's/.*: "\(.*\)",.*/\1/' | while read line; do git clone $line; done
@laurentsenta
laurentsenta / RNG.ts
Created June 2, 2014 17:33
Seedable Random Number Generator in Typescript
export class RNG {
private seed:number;
constructor(seed:number) {
this.seed = seed;
}
private next(min:number, max:number):number {
max = max || 0;
min = min || 0;
@laurentsenta
laurentsenta / eve-skills-beginners
Last active August 29, 2015 14:05
Eve Skill List
Start With: Get these skills to the listed level ASAP.
(Gallente, Minmatar ignore the drone)
- Gallente Frigate III (or your racial frigate)
- Afterburner III
- High Speed Maneuvering I
- Propulsion Jamming I
- Hull Upgrades III
- Weapon Upgrades I
@laurentsenta
laurentsenta / meh-macro
Created June 23, 2015 08:04
Meh: A clojure macro for clj-rethinkdb
(ns db.meh
(:use
[clojure.pprint]
[slingshot.slingshot :only [throw+ try+]])
(:require
[clojure.set :as set]
[taoensso.timbre :as timbre]))
;; Parse
;; -----
@laurentsenta
laurentsenta / header.py
Last active December 23, 2015 16:58
Searchable SVG Figs In Ipython/Jupyter Notebooks
# Render to SVG & Don't transform texts into path
%config InlineBackend.figure_formats=['svg']
matplotlib.rcParams['svg.embed_char_paths'] = False
@laurentsenta
laurentsenta / conftest.py
Last active February 5, 2016 10:20
pytest not calling hooks with TestCase
import pytest
@pytest.hookimpl(hookwrapper=True)
def pytest_pyfunc_call(pyfuncitem):
1 / 0
outcome = yield
(defproject frontend "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.8.0"]
[ring "1.5.0"]
[org.clojure/clojurescript "1.8.51"]
[org.clojure/tools.logging "0.3.1"]
[shodan "0.4.2"]
[devcards "0.2.2"]
[binaryage/devtools "0.8.2"]
[prismatic/dommy "1.1.0"] ;; dom manipulation
[slingshot "0.12.2"]
@laurentsenta
laurentsenta / blockchain_init.py
Last active October 11, 2017 06:47
SingularGarden - How to implement a Blockchain - Init
# https://github.com/singulargarden/ouroboros/blob/v0.1/ouroboros/blockchain/__init__.py
ZERO_HASH = '0' * 96
def make_block(previous_hash, payload):
"""Produce a new block"""
previous_hash_bytes = encode(previous_hash)
# Generate a fingerprint of the new state:
# hash the fingerprint of the previous state and the payload leading to the new state.
hash_ = sha3(previous_hash_bytes, payload)
@laurentsenta
laurentsenta / blockchain_append.py
Last active October 11, 2017 07:39
SingularGarden - How to implement a Blockchain - Append
# https://github.com/singulargarden/ouroboros/blob/v0.1/ouroboros/blockchain/__init__.py
def prepare_block(root_path, payload):
# Load the current blockchain state
current_descr = load_descr(root_path)
# Create the new block attached to the current head of the chain
current_block_hash = current_descr.head_hash
new_block = make_block(current_block_hash, payload)