Skip to content

Instantly share code, notes, and snippets.

@aaronbassett
aaronbassett / fancy_sms.py
Created December 21, 2018 16:02
Send Fancy SMS with Python and the Nexmo SMS API
import os
import click
import nexmo
import string
@click.command()
@click.argument(
"font",
type=click.Choice(
@aaronbassett
aaronbassett / sms.py
Created June 11, 2019 15:04
Python Glasgow
# 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!'})
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])
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',
[{
$addFields: {
fizzbuzz: {
$switch: {
branches: [{
case: {
$and: [{
$eq: [{
$mod: ["$counter", 3]
}, 0]
@aaronbassett
aaronbassett / doc-geojson.json
Last active March 22, 2020 23:35
dev.to - Finding users within X km/miles of a zip code
{
"_id":{
"$oid":"5e4182c55b13920bcc41ff64"
},
"address":{
"address1":"Suite 442",
"address2":"855 Owens Track",
"city":"Burwell",
"country":"USA",
"state":"NE",
[
{ "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 },