Skip to content

Instantly share code, notes, and snippets.

View tuulos's full-sized avatar

Ville Tuulos tuulos

View GitHub Profile
def fun_mapinit(input_iter, params):
import os
os.environ["DYLIB_LIBRARY_PATH"] = "your_path"
params.pycuda = __import__("pycuda")
handle_cast({update_config_table, Config}, S) ->
error_logger:info_report([{"Config table update"}]),
Update = fun({Host, Slots}, DNodes) ->
DNode = case gb_trees:lookup(Host, S#state.nodes) of
none ->
#dnode{name = Host,
slots = Slots,
node_mon = monitor(Host)};
{value, N} ->
N#dnode{slots = Slots}
handle_cast({update_config_table, Config}, S) ->
error_logger:info_report([{"Config table update"}]),
Update =
fun({Host, Slots}, DNodes) ->
DNode =
case gb_trees:lookup(Host, S#state.nodes) of
none ->
#dnode{name = Host,
slots = Slots,
node_mon = monitor(Host)};
handle_cast({update_config_table, Config}, S) ->
error_logger:info_report([{"Config table update"}]),
UpdateNodes = fun({Host, Slots}, DNodes) ->
DNode = case gb_trees:lookup(Host, S#state.nodes) of
none ->
#dnode{name = Host,
slots = Slots,
node_mon = monitor(Host)};
{value, N} ->
N#dnode{slots = Slots}
@tuulos
tuulos / README.md
Created March 10, 2012 01:36
Bitdeli Visualization Example: Trains arriving to BART stations in next 15 minutes

Bitdeli visualization example: Trains arriving to BART stations in next 15 minutes

This example shows how to use real-time data from the Bitdeli API to create visualizations with RaphaelJS.

The visualization shows a BART station on each column. The further the estimated time arrival is for a train, the further it is drawn from its destination station down bottom. The data is updated once a minute. Refresh the page to see the updated status.

The data originates from the BART API through this Bitdeli script.

You can view the live visualization here with bl.ocks.org.

@tuulos
tuulos / gist:4029841
Created November 7, 2012 06:29
Churn in Bitdeli
import bitdeli, json
from datetime import datetime
from time import mktime, strptime
bitdeli.set_theme('eighties')
BASELINE = mktime(strptime('2012-03-01', '%Y-%m-%d'))
all_users = [0] * 30
active_users = [0] * 30
@tuulos
tuulos / bitdeli-bulk-load.py
Last active October 12, 2015 12:57
fix sending of the remaining buffer
import json
import sys
import urllib
BITDELI_API = 'https://track.bitdeli.com/events'
MAX_BUFFER_SIZE = 8 * 1024 * 1024
DATA = sys.argv[1]
INPUT_ID = sys.argv[2]
AUTH = sys.argv[3]
@tuulos
tuulos / reproduce-munmap-issue.go
Created August 9, 2016 00:15
Reproduce tdb.close() issue in Go. Comment out db.Close() to make this work.
package main
import (
"os"
"sync"
"github.com/traildb/traildb-go"
)
var NUM_WORKERS = 16
@tuulos
tuulos / analyze_artifacts.py
Last active August 18, 2021 06:04
Analyze artifacts
from metaflow import Parameter, current, Flow, step, FlowSpec
from functools import wraps
class ArtifactProxy:
def __init__(self, flow):
params = {x.id for x in Flow(current.flow_name)[current.run_id]['_parameters'].task}
base = {x for x in dir(flow) if x not in params}
self.__dict__.update({
'_artifacts_flow': flow,