Skip to content

Instantly share code, notes, and snippets.

@toolness
toolness / adventures-in-python-core-dumping.md
Last active December 19, 2024 09:29
Adventures in Python Core Dumping

Adventures in Python Core Dumping

After watching Bryan Cantrill's presentation on [Running Aground: Debugging Docker in Production][aground] I got all excited (and strangely nostalgic) about the possibility of core-dumping server-side Python apps whenever they go awry. This would theoretically allow me to fully inspect the state of the program at the point it exploded, rather than relying solely on the information of a stack trace.

@yesvods
yesvods / async-parallel.js
Created July 21, 2015 09:11
ES6 async parallel execution
//mock a fs Object
let fs = {
readFile: function(filename, cb){
let randomTime = 100+Math.random()*1000>>0;
setTimeout(()=>{
cb(`hello ${filename}`)
}, randomTime)
}
}
@pixyj
pixyj / decanting.py
Last active August 29, 2015 14:18
Solution to Decanting problem with capacities 8, 5, 3
"""
Problem Description:
You are given three vessels A, B and C of capacities 8, 5 and 3 gallons respectively. A is filled, while B and C are empty.
Divide the liquid in A into two equal quantities.
(From Graph Theory, Narsingh Deo)
http://bit.ly/1Dnp4HA
Usage:
import decanting as dc
import networkx as nx
@gaearon
gaearon / AudioPlayer.jsx
Created October 31, 2014 22:13
React <audio> wrapper
/** @jsx React.DOM */
'use strict';
var React = require('react'),
{ PropTypes } = React;
var AudioPlayer = React.createClass({
propTypes: {
source: PropTypes.string.isRequired,
isPlaying: PropTypes.bool.isRequired,

A pseudonymous trust system for a decentralized anonymous marketplace

Dionysis Zindros, National Technical University of Athens [email protected]

Keywords

pseudonymous anonymous web-of-trust identity trust bitcoin namecoin proof-of-burn timelock decentralized anonymous marketplace openbazaar

Abstract

@kazad
kazad / fourier.html
Created June 25, 2014 19:00
BetterExplained Fourier Example
<html>
<head>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.2/underscore-min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
<script src="//ajax.cdnjs.com/ajax/libs/json2/20110223/json2.js"></script>
<!--
TODO:
@pfrazee
pfrazee / gist:8949363
Last active August 22, 2023 12:31
In-Application Sandboxing with Web Workers

In-Application Sandboxing with Web Workers

A design rationale.

For the past fews years, the Web has been shifting control to the client. Given the limitations of remote services, developers are now looking for ways to "unhost" static applications – that is, break the dependency on remote servers while still using the Web platform.

One untapped technology for client-side control is the Web Worker Sandbox. This API lets the Page load, execute, and destroy separate Worker threads which use their own Virtual Machines. By using Worker Sandboxes to drive behavior, the Web can give users the choice of which software they run together, shifting development from a centralized SaaS model into a distributed and free (as in freedom) script-sharing model.

Worker Sandboxes can Execute Arbitrary Code

@pixyj
pixyj / watchdog_starter
Created February 6, 2014 09:22
Seed file for listening to filesystem changes using python watchdog
import os
import time
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
class VHandler(FileSystemEventHandler):
def __init__(self):
FileSystemEventHandler.__init__(self)
@ftonello
ftonello / url-shortner.c
Last active November 3, 2018 14:44
URL shortner implementation in C. This is just an example how it could be implemented. Ideally the lookup table should be pre-generated and not hardcoded.
/**
* Author: Felipe Ferreri Tonello <[email protected]>
*
* This url-shortner it only works with ASCII characters. It encodes and
* decodes ids.
* You can change base_x as you wish.
*
* It runs at least 20 times faster then a Python implementation.
*
* $ time python url-shortner.py -s I7
@debasishg
debasishg / gist:8172796
Last active April 20, 2025 12:45
A collection of links for streaming algorithms and data structures

General Background and Overview

  1. Probabilistic Data Structures for Web Analytics and Data Mining : A great overview of the space of probabilistic data structures and how they are used in approximation algorithm implementation.
  2. Models and Issues in Data Stream Systems
  3. Philippe Flajolet’s contribution to streaming algorithms : A presentation by Jérémie Lumbroso that visits some of the hostorical perspectives and how it all began with Flajolet
  4. Approximate Frequency Counts over Data Streams by Gurmeet Singh Manku & Rajeev Motwani : One of the early papers on the subject.
  5. [Methods for Finding Frequent Items in Data Streams](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.9800&amp;rep=rep1&amp;t