Skip to content

Instantly share code, notes, and snippets.

@JosephRedfern
JosephRedfern / YouTube 8m Video ID scraper.py
Last active August 12, 2021 02:22
Scrapes the youtube video IDs for the youtube-8m data set. Probably buggy. Could be threaded.
import requests
from collections import defaultdict
csv_prefix = "https://research.google.com/youtube8m/csv"
r = requests.get("{0}/verticals.json".format(csv_prefix))
verticals = r.json()
block_urls = defaultdict(list)
count = 0
/*
* © 2016 - Julián Acosta
* License: CC BY-SA 4.0 (http://creativecommons.org/licenses/by-sa/4.0/)
*
* Print your own logo in developer tools!
*
* Step 1: Convert your logo to ASCII text here: http://picascii.com (I used color output)
* Note: Is possible that you'll have to resize your photo in order to retain aspect ratio
* Step 2: Remove the <pre></pre> tag that is surrounding the generated code, replace with "[" and "]"
* Step 3: Run the following regexes (*DON'T ALTER THE ORDER*) in order to convert to JSON (Works in PHPStorm and Sublime Text 2):
@remi
remi / shc.js
Last active March 2, 2022 14:32
Extract JSON object from https://smarthealth.cards QR code
// Extract JSON payload from SHC QR code (without any kind of private/public key verification)
// Credits + inspiration
// https://github.com/dvci/health-cards-walkthrough/blob/main/SMART%20Health%20Cards.ipynb
// Usage
// $ node shc.js "shc:/01234569…"
const zlib = require("zlib");
@alexellis
alexellis / HackingOnLiveStreaming.md
Created June 1, 2017 12:48
HackingOnLiveStreaming

Additional notes

Original blog post - http://blog.alexellis.io/live-stream-with-docker/

How do I rebuild the image from scratch?

This will take several hours on a Raspberry Pi Zero - but less time on a Pi 2 or Pi 3. You can edit the Dockerfile for a Pi 2/3 and change RUN make to RUN make -j 4 to take advantage of the quad-core processor.

$ git clone https://github.com/alexellis/raspberrypi-youtube-streaming/
@sintaxi
sintaxi / regions.txt
Last active March 28, 2022 02:12
Surge Regions
List of regions your project is served from when you deploy using surge.
yyz.surge.sh : 159.203.50.177 : CA : Toronto
jfk.surge.sh : 159.203.159.100 : US : New York
sfo.surge.sh : 138.197.235.123 : US : San Francisco
lhr.surge.sh : 46.101.67.123 : GB : London
ams.surge.sh : 188.166.132.94 : NL : Amsterdam
fra.surge.sh : 138.68.112.220 : DE : Frankfurt
sgp.surge.sh : 139.59.195.30 : SG : Singapore
@NotSqrt
NotSqrt / settings_test_snippet.py
Last active May 1, 2022 01:34 — forked from nealtodd/settings_test_snippet.py
Another shot at this problem ..
class DisableMigrations(object):
def __contains__(self, item):
return True
def __getitem__(self, item):
return "notmigrations"
MIGRATION_MODULES = DisableMigrations()
@quellish
quellish / FBClasses.txt
Created August 15, 2015 01:50
Facebook iOS App Class List
headers:
_ASAsyncTransaction.h
_ASAsyncTransactionGroup.h
_ASDisabledPanUITextView.h
_ASDisplayLayer.h
_ASDisplayLayerDelegate-Protocol.h
_ASDisplayView.h
_ASImageNodeDrawParameters.h
_ASPendingState.h
_ASTextNodeCachedMetrics.h
@waynemoore
waynemoore / month_day_range.py
Created July 27, 2011 11:01
Get first and last day of a particular month using python-dateutil.
import datetime
# requires python-dateutil (http://labix.org/python-dateutil)
from dateutil.relativedelta import relativedelta
def get_month_day_range(date):
"""
For a date 'date' returns the start and end date for the month of 'date'.
Month with 31 days:
@masukomi
masukomi / fizzbuzz.py
Last active May 23, 2022 23:55 — forked from Gorcenski/fizzbuzz.py
The most obnoxious solution to FizzBuzz I can imagine.
# Emily Gorcensky's "obnoxious" fizz-buzz (less-compact version) annotated for non-python geeks.
# Explanation via Twitter: https://twitter.com/EmilyGorcenski/status/1228407309656903680?s=20
# If you want to dive into the meanings of how it works: it models fizzbuzz by
# computing the isomorphism of the finite cyclic groups of the values of the
# fizzes and buzzes and whatnot.
#
# These abelian groups are mapped to the unit circle in the complex plane and
# Represented as roots of unity. Such a interpetation has a polynomial
# representation. Therefore, the cartesian product in the isomorphism is
# represented as polynomial multiplication. The coefficients of a Polynomial
@Gorcenski
Gorcenski / fizzbuzz.py
Last active May 23, 2022 23:55
The most obnoxious solution to FizzBuzz I can imagine.
import numpy as np
from functools import reduce
class Buzzer:
def __init__(self, **kwargs):
values = [v for k, v in kwargs.items()]
self.kwargs = kwargs
self.lcm = np.lcm.reduce(values)
self.eps = 1e-7