Skip to content

Instantly share code, notes, and snippets.

View mikedouglas's full-sized avatar

Michael Douglas mikedouglas

View GitHub Profile
mjd@M1 nft-bounty % http -v 'https://api.opensea.io/api/v1/assets?asset_contract_addresses=0x15A2d6C2b4B9903C27f50Cb8B32160ab17F186E2&asset_contract_addresses=0xa406489360A47Af2C74fc1004316A64e469646A5&token_ids=5438&token_ids=2834'
GET /api/v1/assets?asset_contract_addresses=0x15A2d6C2b4B9903C27f50Cb8B32160ab17F186E2&asset_contract_addresses=0xa406489360A47Af2C74fc1004316A64e469646A5&token_ids=5438&token_ids=2834 HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: api.opensea.io
User-Agent: HTTPie/2.5.0
btdx::NAVY=> SELECT * FROM market_btchistoricalrates WHERE date_trunc('second', timestamp) = '2014-02-15 00:58:00+00';
id | timestamp | bid_rate | ask_rate
-----+-------------------------------+--------------+--------------
161 | 2014-02-15 00:58:00.658727+00 | 655.05330000 | 668.67050000
162 | 2014-02-15 00:58:00.767935+00 | 655.05330000 | 668.67050000
163 | 2014-02-15 00:58:00.676315+00 | 655.05330000 | 668.67050000
164 | 2014-02-15 00:58:00.759772+00 | 655.05330000 | 668.67050000
165 | 2014-02-15 00:58:00.662886+00 | 655.05330000 | 668.67050000
166 | 2014-02-15 00:58:00.772852+00 | 655.05330000 | 668.67050000
167 | 2014-02-15 00:58:00.704243+00 | 655.03350000 | 668.67050000

Keybase proof

I hereby claim:

  • I am mikedouglas on github.
  • I am mjd (https://keybase.io/mjd) on keybase.
  • I have a public key whose fingerprint is CA9C 5B25 5F47 338E 0B59 23D7 FD84 C95A 3A38 3F05

To claim this, I am signing this object:

@mikedouglas
mikedouglas / gist:6243706
Created August 15, 2013 19:00
Detecting an launching an iOS app, or redirecting to fallback url.
<iframe id="i" style="display:none" height=0 width=0></iframe>
<script>
[...]
//// CONFIGURATION
launch_timeout = 1500;
margin_of_error = 500;
close_delay = 1000;
close_interval = 3000;
@mikedouglas
mikedouglas / gist:3753307
Created September 20, 2012 00:51
Differences
Files good_jar/ata/common/ActionBar$AbstractAction.class and bad_jar/ata/common/ActionBar$AbstractAction.class differ
Files good_jar/ata/common/ActionBar$Action.class and bad_jar/ata/common/ActionBar$Action.class differ
Files good_jar/ata/common/ActionBar$ActionList.class and bad_jar/ata/common/ActionBar$ActionList.class differ
Files good_jar/ata/common/ActionBar$BadgeAction.class and bad_jar/ata/common/ActionBar$BadgeAction.class differ
Files good_jar/ata/common/ActionBar$HomeAction.class and bad_jar/ata/common/ActionBar$HomeAction.class differ
Files good_jar/ata/common/ActionBar$IntentAction.class and bad_jar/ata/common/ActionBar$IntentAction.class differ
Files good_jar/ata/common/ActionBar$RunnableAction.class and bad_jar/ata/common/ActionBar$RunnableAction.class differ
Files good_jar/ata/common/ActionBar.class and bad_jar/ata/common/ActionBar.class differ
Only in good_jar/ata/common: ActivityUtils$1.class
Only in good_jar/ata/common: ActivityUtils$2.class
import types
class Object(object):
def __getitem__(self, key):
return 2*self.__getitem__(key)
obj = Object()
obj.__getitem__ = types.MethodType((lambda self, x: x), obj)
obj[5] #=> 10
@mikedouglas
mikedouglas / gist:1927956
Created February 27, 2012 23:45
Brian Kernighan's Solution
/* match: search for regexp anywhere in text */
int match(char *regexp, char *text)
{
if (regexp[0] == '^')
return matchhere(regexp+1, text);
do { /* must look even if string is empty */
if (matchhere(regexp, text))
return 1;
} while (*text++ != '\0');
return 0;
@mikedouglas
mikedouglas / README.mkd
Created August 20, 2011 05:24 — forked from mbostock/.block
Hilbert Tiles

Say you have a bunch of things, like thousands of photos from your digital camera. What if you wanted to look at them all at once? A typical user interface might order the photos chronologically by column and then by row, which does a decent job of grouping related photos together... But, if you have thousands of photos, the rows may be hundreds of photos long, and it is impossible to zoom in on a group of related photos!

An alternative that better preserves locality is a space-filling curve, such as the Hilbert curve. These curves can be used to place related things next to each other in space, avoiding those huge gaps across rows you see with sequential layout.

This example demonstrates the effect of using a Hilbert curve for layout with Polymaps by generating rainbow-colored tiles. As you can see, each tile is surrounded by its adjacent colors in the rainbow, even as you zoom in and ou

#ifdef __APPLE__
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#include <GLUT/glut.h>
#else
#ifdef _WIN32
#include <windows.h>
#endif
#include <GL/gl.h>
#include <GL/glu.h>
(defn- index
[coll]
(map vector (iterate inc 0) coll))
(defn- pos
[elm coll]
(for [[i e] (index coll) :when (e elm)] i))
(defn convert
"Convert the results of `live` into intervals."