Skip to content

Instantly share code, notes, and snippets.

View grantstephens's full-sized avatar
🍍

Grant Stephens grantstephens

🍍
View GitHub Profile

Keybase proof

I hereby claim:

  • I am grantstephens on github.
  • I am grantstephens (https://keybase.io/grantstephens) on keybase.
  • I have a public key ASCcfpM2YItC48gTCgkHWlGWE4sQnXoFcurGnKadwSWw_Ao

To claim this, I am signing this object:

@grantstephens
grantstephens / rateburstlimiter.py
Last active February 7, 2017 11:03
Rate Limiting Decorator that allows bursts
import time
def RateLimited(maxPerSecond, burst=1):
minInterval = 1.0 / float(maxPerSecond)
def decorate(func):
firstBurst = [0.0]
burstCount = [0]
@grantstephens
grantstephens / sync.py
Created September 10, 2017 06:12
Garmin Connect Sync Script for Linux (python)
# Syncs files on a garmin device to garmin connect and keeps a local copy.
# auth.json contains your garmin connect username(email) and password.
import json
import os
import shutil
import requests
@grantstephens
grantstephens / Flashing OpenWRT.md
Last active November 5, 2023 10:21
TP-Link TL-WR902AC v3 OpenWRT Setup

Important Links:

Flash instruction:

The only way to flash LEDE image in TL-WR902AC v3 is to use tftp recovery mode in U-Boot:

  1. Configure PC with static IP 192.168.0.66/24 and tftp server.
  2. Rename "openwrt-ramips-mt76x8-tplink_tl-wr902ac-v3-squashfs-tftp-recovery.bin" to "tp_recovery.bin" and place it in tftp server directory.
@grantstephens
grantstephens / Twilio SMS Forward
Created January 31, 2019 11:40
Twilio Function Script to forward text messages sent to a twilio number to email via the mandril api
const mandrill = require('mandrill-api')
mandrill_client = new mandrill.Mandrill('#key-here');
exports.handler = function(context, event, callback) {
const message = {
"text": event.Body,
"subject": `New SMS message from: ${event.From}`,
"from_email": "#from-address here",
"from_name": "#from-here",
"to": [{
@grantstephens
grantstephens / tf.Dockerfile
Created December 20, 2019 17:40
Dockefile for building libtensorflow.so (Working for v2.0)
FROM ubuntu:18.10
RUN apt update && apt install -y \
build-essential \
curl \
git \
wget \
libjpeg-dev \
openjdk-8-jdk \
gcc-7 \
@grantstephens
grantstephens / Dockerfile
Last active September 3, 2021 12:47
Dockerfile for building Tensorflow 2.0.1 from source with Extra CPU (SSE4.1 SSE4.2 AVX AVX2 FMA) instructions
FROM ubuntu:18.04
RUN apt update && apt install -y \
build-essential \
curl \
git \
wget \
libc-ares-dev \
libjpeg-dev \
openjdk-8-jdk \
@grantstephens
grantstephens / main.go
Created January 22, 2020 21:51
Example of wasm freezing
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"gioui.org/app"
"gioui.org/io/system"
@grantstephens
grantstephens / ipv4.go
Last active March 20, 2020 16:03
Golang Function to determine if a host is a valid IPv4 Address
func IsIPv4Net(host string) bool {
valid := net.ParseIP(host) != nil
if valid {
return !strings.ContainsRule(host, ':')
}
return false
}