Instantly share code, notes, and snippets.

🙌
🙌

# Loisaida Samloisaidasam

🙌
🙌
• Sort options
Last active Sep 20, 2017
Image EXIF Distance Tools

# Image EXIF Distance Tools

Some scripts for finding the distance between the location of an image and the Bank of America Building in Atlanta (or maybe you have a better use-case).

## Usage

``````\$ ./image-distance.sh <filename.jpg>
``````
Last active Jul 23, 2019
Python implementation - Lower bound of Wilson score confidence interval for a Bernoulli parameter
View wilson.py
 """ Python implementation - Lower bound of Wilson score confidence interval for a Bernoulli parameter - http://www.evanmiller.org/how-not-to-sort-by-average-rating.html - https://news.ycombinator.com/item?id=15131611 - https://stackoverflow.com/questions/10029588/python-implementation-of-the-wilson-score-interval/45965534 - https://stackoverflow.com/questions/10029588/python-implementation-of-the-wilson-score-interval/45965534#45965534 """ import math
Created Jul 24, 2017
Get the URL of a retriever from dog.ceo
View retriever-pic
 #!/bin/bash # Requires `curl` and `jq` # Nice use case: \$ open "\$(retriever-pic)" curl -Ss "https://dog.ceo/api/breed/retriever/images/random" | jq -r '.message'
Created Jun 6, 2017
Sampling with replacement covers ~63.2% of source data
View sampling_with_replacement.py
 In [1]: import random In [2]: import numpy as np In [3]: SIZE = 1000000 In [4]: data = range(SIZE) In [5]: results = []
Last active Aug 10, 2017
Search for Fantasy Factory keepers from 2016 draft
View 1_results.txt
 1. David Johnson (D'Pez Poopsie) round: 1 draft_position: 8 2. Le'Veon Bell (Hyde yo kids Hyde yo wife) round: 1 draft_position: 9 3. Antonio Brown (You'll Shoot Your Eye Out!) round: 1 draft_position: 5 4. Ezekiel Elliott (Show me your Hogan) round: 1 draft_position: 4 5. Odell Beckham Jr. (Winning is not my Forte) round: 1 draft_position: 6 6. Julio Jones (Skippin Showers Switching Socks) round: 1 draft_position: 7 7. LeSean McCoy (Hyde yo kids Hyde yo wife) round: 2 draft_position: 16 8. Mike Evans (Ha Ha Cinton-Dix) round: 3 draft_position: 26 9. Jordy Nelson (CamNThBlkPnthrs Lives Matter) round: 2 draft_position: 24 10. A.J. Green (Iron Fist Commish) round: 1 draft_position: 12
Last active May 24, 2017
Get the basename for a URL or path file
View get_basename.sh
 #!/bin/bash # Turn a URL or path like this: # # "https://lastfm-img2.akamaized.net/i/u/300x300/daa535a86371482ec8fd7f3451114367.png" # # into this: # # "daa535a86371482ec8fd7f3451114367.png"
Last active May 3, 2017
View strip-requirements.sh
 #!/bin/bash # Strip out comments/whitespace/etc. from requirements.txt if [ -z "\$1" ] then echo "Missing input requirements.txt dep!" exit 1 fi
Created Apr 21, 2017
Clean out virtualenv - uninstall all installed libs
View clean_out_virtualenv.sh
 #!/bin/bash libs=\$(pip freeze |cut -d'=' -f1) #echo \$libs pip uninstall -y \$libs
Last active Apr 10, 2017
Reverse-engineering NextBus realtime data for the Atlanta Streetcar

Realtime data for the Atlanta Streetcar doesn't seem to be available via an API, and yet this page exists with a realtime map:

It seems they utilize a nonce-like concept for validation, although it's not fully baked. They hard-code an initial key in the javascript of the actual pageload, which you can use for all subsequent lookups. On the actual page, they take the response key from each subsequent request and pass the new one each time along with a count variable called `cnt`, but in practice it seems that isn't actually required. The only limitation seems to be you have to fake the referer header.