Skip to content

Instantly share code, notes, and snippets.

🙌
🙌

Loisaida Sam loisaidasam

🙌
🙌
View GitHub Profile
@loisaidasam
loisaidasam / story.ipynb
Created May 1, 2020
Story about numpy ndarrays with nested sequences
View story.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@loisaidasam
loisaidasam / results.txt
Last active Feb 12, 2020
Python: setattr() vs. direct object manipulation
View results.txt
$ python test_setattr.py
test_setattr 0.11335835400000001
test_direct_object_manipulation 0.04550438199999998
$ python test_setattr_data_types.py
int
setattr() 0.104297199
direct obj manipulation 0.046985358000000005
float
setattr() 0.097025698
@loisaidasam
loisaidasam / README.md
Created Jan 31, 2020
How often can we celebrate someone's birthday in the office?
View README.md

Given a certain amount of employees in an office, how many weeks of the year should it be reasonable to celebrate birthdays?

Assumptions:

  • there are ~200 employees in this office
  • there are 52 weeks in the year
  • there is an equal probability of each employee being born on any of the 52 weeks

Here are 20 trials:

@loisaidasam
loisaidasam / README.md
Last active Dec 2, 2019
Bookmarklet: Strava - Open Group Activities
View README.md

Bookmarklet: Strava - Open Group Activities

In Strava, when you go on a bike ride with other folks, it groups your activities together.

Use this bookmarklet to open up the activities of all of the other people you rode bikes with in separate tabs.

To create the bookmarklet

  • Create a new browser bookmark
  • For location, paste in the contents of bookmarklet.js
@loisaidasam
loisaidasam / dcoms.csv
Last active Nov 18, 2019
The 103 DCOMs now available on Disney+, scraped from https://www.buzzfeed.com/laurengarafano/disney-plus-dcoms using `pup`
View dcoms.csv
title year
Adventures in Babysitting 2016
Alley Cats Strike 2000
Avalon High 2010
Bad Hair Day 2015
Brink! 1998
Buffalo Dreams 2005
Cadet Kelly 2002
Camp Rock 2008
Camp Rock 2: The Final Jam 2010
@loisaidasam
loisaidasam / nytimes-xword-scrape.py
Created Oct 20, 2019
Grab the latest NY Times Crossword puzzle
View nytimes-xword-scrape.py
#!/usr/bin/env python
"""Grab the latest NY Times Crossword puzzle
TODO: Figure out how to get today's puzzle - for some reason this grabs yesterday's
"""
import os
import re
import time
@loisaidasam
loisaidasam / picblast.sh
Last active Aug 2, 2019 — forked from bwhitman/picblast.sh
Make an audio collage out of your live photos
View picblast.sh
#!/bin/bash
mkdir /tmp/picblast
cd ~/Pictures/Photos\ Library.photoslibrary
for i in $(find . | grep jpegvideocompl)
do
ffmpeg -i $i /tmp/picblast/${i:(-8)}.wav
done
@loisaidasam
loisaidasam / git-find-large-files
Created Mar 15, 2019
Shows you the largest objects in your repo's pack file.
View git-find-large-files
#!/bin/bash
# git-find-large-files
# Shows you the largest objects in your repo's pack file.
# Written for osx.
#
# @see https://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
# @see https://stackoverflow.com/questions/10622179/how-to-find-identify-large-commits-in-git-history/10622293#10622293
# @author Antony Stubbs
@loisaidasam
loisaidasam / would-you-rather
Last active Mar 5, 2019
Would You Rather (via rrrather.com API, using curl/jq)
View would-you-rather
#!/bin/bash
jq_str='(.title + ": " + .choicea + " OR " + .choiceb + " - " + .link + " (" + (.votes|tostring) + " votes)")'
curl -Ss "https://www.rrrather.com/botapi" | jq -r "$jq_str"
You can’t perform that action at this time.