Skip to content

Instantly share code, notes, and snippets.

View danielzurawski's full-sized avatar
🏠
Working from home

Daniel Zurawski danielzurawski

🏠
Working from home
View GitHub Profile
@danielzurawski
danielzurawski / dynamodb-throttled-batch-update.js
Last active August 26, 2022 14:05
DynamoDB batch update using Bluebird for async concurrency and a rate limiter
/*
A small node.js script utilising bluebird, node-rate-limiter and aws-sdk to achieve optimal DynamoDB UpdateItem throughput for a provided DDB write capacity / per second
When would this be useful?
Sadly, aws-sdk does not automatically throttle, it just blows up with ProvisionedThroughputExceededException.
So let’s say, you want to update millions of records in Dynamo using the Update operation, without BatchWriteItem which only allows Puts and you want to avoid generating Insert events.
Additionally, you want it to go as fast as your DDB configuration (without burst) allows, but not any faster.
*/
@danielzurawski
danielzurawski / gist:6214628
Created August 12, 2013 20:08
fiz-with-book
(defn fiz-with-book
[look {[x y] :pos}]
(let [move (look [x (inc y)])
move-up [x (dec y)]
move-down [x (inc y)]
move-left [(dec x) y]
move-right [(inc x) y]]
(cond (nil? (look move-up)) {:pos move-up}
(nil? (look move-left)) {:pos move-left}
(nil? (look move-down)) {:pos move-down}
@danielzurawski
danielzurawski / datacentres.json
Created August 21, 2012 10:05
D3.js Azimuthal, orthographic projection with pretty bubbles
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@danielzurawski
danielzurawski / CleanDroid.java
Created April 25, 2012 18:18
CleanDroid Main Class
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.cleandroid;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Toolkit;