Skip to content

Instantly share code, notes, and snippets.

@sepans
sepans / d3.js and p5.js.markdown
Last active January 8, 2023 19:12
d3.js and p5.js
@sepans
sepans / d3.js and p5.js - Voronoi.markdown
Last active August 29, 2015 14:22
d3.js and p5.js - Voronoi
@sepans
sepans / index.html
Last active September 11, 2015 14:23
particles
<div id="container"></div>
<div id='sections'>
<section class="step active">
<div class="title">Title</div>
data not too large and managable
</section>
<section class="step">
<div class="title">Title 2</div>
your data grows as your business grows
</section>
@sepans
sepans / curlUrls.sh
Last active October 23, 2015 19:56
curl ans scap an array of urls with bash script (for uk metoffice weather data)
urls=( http://www.metoffice.gov.uk//pub/data/weather/uk/climate/stationdata/aberporthdata.txt http://www.metoffice.gov.uk//pub/data/weather/uk/climate/stationdata/armaghdata.txt http://www.metoffice.gov.uk//pub/data/weather/uk/climate/stationdata/ballypatrickdata.txt http://www.metoffice.gov.uk//pub/data/weather/uk/climate/stationdata/bradforddata.txt http://www.metoffice.gov.uk//pub/data/weather/uk/climate/stationdata/braemardata.txt
http://www.metoffice.gov.uk//pub/data/weather/uk/climate/stationdata/cambornedata.txt http://www.metoffice.gov.uk//pub/data/weather/uk/climate/stationdata/cambridgedata.txt http://www.metoffice.gov.uk//pub/data/weather/uk/climate/stationdata/cardiffdata.txt http://www.metoffice.gov.uk//pub/data/weather/uk/climate/stationdata/chivenordata.txt http://www.metoffice.gov.uk//pub/data/weather/uk/climate/stationdata/cwmystwythdata.txt
http://www.metoffice.gov.uk//pub/data/weather/uk/climate/stationdata/dunstaffnagedata.txt http://www.metoffice.gov.uk//pub/data/weather/uk/climate/statio
@sepans
sepans / flickrUrls.js
Created December 15, 2015 19:03
one line to print flickr thumbnail url in a flickr search result
// copy and paste it to console to get all filenams. if didn't work update '.photo-list-photo-view' with correct div class
[].forEach.call( document.querySelectorAll('.photo-list-photo-view'), function(item) { var url = item.style.backgroundImage.replace('url("//',''); url = url.replace('")',''); console.log(url); });
@sepans
sepans / README.md
Last active August 3, 2023 20:18
Implementation of Random Projection Locality Sensitive Hashing

Port of this python code in Javascript.

LSH from Wikipedia:

Locality-sensitive hashing (LSH) reduces the dimensionality of high-dimensional data. LSH hashes input items so that similar items map to the same “buckets” with high probability (the number of buckets being much smaller than the universe of possible input items). LSH differs from conventional and cryptographic hash functions because it aims to maximize the probability of a “collision” for similar items. Locality-sensitive hashing has much in common with data clustering and nearest neighbor search.

More explanation:

@sepans
sepans / bot taxonomy.md
Last active August 12, 2016 03:38 — forked from tullyhansen/gist:7621632
Draft spec 0.3 for a bot taxonomy (see also http://i.imgur.com/bKXNQ0V.png) #botALLY

Source: https://gist.github.com/tullyhansen/7621632

Towards a Taxonomy of Twitter Bots

Intro

  • towards a definition - autonomous non-human agents on Twitter
  • critical thinking - MECE, rabbit rule, holding hands
  • patterns of behaviour, rather than content
  • Twitter largely a textual medium
@sepans
sepans / add_operations_to_mp.md
Last active November 26, 2018 17:53
How to add operations (mutations/queries) to Metaphysics to expose Exchange operations to clients

After adding an operation (mutation or query) to exchange the corresponding operation has to be added to Metaphysics. Because most of the clients don't use exchange directly since exchange doesn't know anything about galleries, users or artworks and it only keeps the ID of those entities. MP pulls that data from gravity and adds that to the order object coming from exchange.

This is a temporary solution for now. Graphql has a mechanism called sticking that can infer all these from the schema and defined types. At this point stitching is not fully implemented so it needs to be done manually. If you know that stitching is enabled for exchange stop reading and delete this document immediately.

How?

Follow this PR as a reference: artsy/metaphysics#1375

  1. Copy updated exchange schema which includes the new mutation here: src/data/exchange.graphql (from exchange/_schema.graphql)
#!/bin/bash
verbose=`$( $2 = "-v" )`
verbose=0; [ "$2" == "-v" ] && verbose=1
echo "counting lines in directory: $1 params? $2, verbose: use -v? $verbose"
sum=0
for filename in `find "$1" -type f`
do
if [ $verbose = 1 ]
then