Skip to content

Instantly share code, notes, and snippets.

View header-counts.json
[
{ "Number of Headers": 9, "Count": 850456 },
{ "Number of Headers": 7, "Count": 646445 },
{ "Number of Headers": 8, "Count": 625424 },
{ "Number of Headers": 11, "Count": 621524 },
{ "Number of Headers": 10, "Count": 577927 },
{ "Number of Headers": 6, "Count": 498719 },
{ "Number of Headers": 5, "Count": 472418 },
{ "Number of Headers": 15, "Count": 408587 },
{ "Number of Headers": 14, "Count": 401035 },
@aaronbassett
aaronbassett / doc-geojson.json
Last active Mar 22, 2020
dev.to - Finding users within X km/miles of a zip code
View doc-geojson.json
{
"_id":{
"$oid":"5e4182c55b13920bcc41ff64"
},
"address":{
"address1":"Suite 442",
"address2":"855 Owens Track",
"city":"Burwell",
"country":"USA",
"state":"NE",
View fizzbuzz-pipeline
[{
$addFields: {
fizzbuzz: {
$switch: {
branches: [{
case: {
$and: [{
$eq: [{
$mod: ["$counter", 3]
}, 0]
View newSale.js
exports = function(changeEvent) {
const http = context.services.get("salesHTTP");
const fullDocument = changeEvent.fullDocument;
return http.post({
url: "https://api.pushover.net/1/messages.json",
body: {
token: context.values.get("PUSHOVER_API_TOKEN"),
user: context.values.get("PUSHOVER_USER"),
title: 'New Sale',
View pride-flag-loop.py
while True:
for infile in glob.glob("pride/*.png"):
im = Image.open(infile)
pixel_grid = list(im.getdata())
for channel in range(8):
pixels = pixel_grid[channel:-1:8]
for num, pixel in enumerate(pixels):
pixel = darken_color(pixel[0], pixel[1], pixel[2], factor=0.3)
set_pixel(mote_hosts, channel + 1, num, pixel[0], pixel[1], pixel[2])
View sms.py
# Basic send
response = client.send_message({'from':NEXMO, 'to':ME, 'text':'Merry Christmas'})
response['messages'][0]['status']
# Send as my dad
response = client.send_message({'from':os.environ['DADS_NUMBER'], 'to':ME, 'text':'I\'m proud of you'})
response['messages'][0]['status']
# Send as Python Glasgow
response = client.send_message({'from':'PyGlasgow', 'to':ME, 'text':'Hello!'})
@aaronbassett
aaronbassett / fancy_sms.py
Created Dec 21, 2018
Send Fancy SMS with Python and the Nexmo SMS API
View fancy_sms.py
import os
import click
import nexmo
import string
@click.command()
@click.argument(
"font",
type=click.Choice(