Skip to content

Instantly share code, notes, and snippets.

@alediaferia
alediaferia / tiny_uploader.js
Last active November 27, 2022 01:36
A tiny snippet for reading files chunk by chunk in plain JavaScript
/*
Copyright (c) 2015-2020 Alessandro Diaferia
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@jathanism
jathanism / commanduo.py
Created January 16, 2013 02:01
A ``ReactorlessCommando`` subclass that allows for running multiple Commando instances in the same program under the same reactor by preventing the instances from doing it themselves.
# commanduo.py - Running multiple Commando's in the same script
from trigger.cmds import Commando as CommandoBase
from twisted.internet import defer, task, reactor
from twisted.python import log
import sys
# Uncomment me for verbose logging.
#log.startLogging(sys.stdout, setStdout=False)
@jprante
jprante / BulkWrite.java
Created May 2, 2012 18:21
Performing multithreaded asynchronous bulk writes to Elasticsearch
/*
* Licensed to Jörg Prante and xbib under one or more contributor
* license agreements. See the NOTICE.txt file distributed with this work
* for additional information regarding copyright ownership.
*
* Copyright (C) 2012 Jörg Prante and xbib
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation; either version 3 of the License, or
@kyledrake
kyledrake / gist:2120107
Created March 19, 2012 17:24
Rainbows! config file for use with EventMachine
# This is a configuration script for using Rainbows with EventMachine. I'm providing it incase somebody finds it useful. But honestly, you
# should stop using EventMachine and use threads instead. The ThreadPool version of this is also in my gist list, and I recommend taking a look at that instead.
# NO, SERIOUSLY, STOP USING EVENTMACHINE.
Rainbows! do
name = 'yourappname'
use :EventMachine
client_max_body_size nil # This is set in nginx
# keepalive_timeout 1
@ktheory
ktheory / README.rdoc
Created April 14, 2011 18:12
An example for logging Fog requests in a Rails app

Instrument Fog Requests in Rails

This code adds debug statements to the rails log for each fog reqests (similar to how active record shows SQL queries):

Fog AWS Compute Request (803.0ms)  [ {"Action"=>"DescribeInstances", ...} ]

The end of the request includes cumulative Fog info:

Completed 200 OK in 6043ms (Views: 2955.0ms | ActiveRecord: 319.9ms | Fog: 1642.6ms, 4 reqs)