Skip to content

Instantly share code, notes, and snippets.

View wgaylord's full-sized avatar

William Gaylord wgaylord

View GitHub Profile
@wgaylord
wgaylord / play.c
Last active December 13, 2023 22:49 — forked from blippy/play.c
Playing hard-coded audio on an ESP32 via DAC
#include <stdio.h>
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/gpio.h"
#include "sdkconfig.h"
#include <driver/dac.h>
// The 8-bit values in our sound sample
#include "track.h"
@wgaylord
wgaylord / gist:b9408cbfbfe030509647a5b10bcd910f
Created May 10, 2017 16:07 — forked from ebuckley/gist:1842461
python code to encode/decode morse code
morseAlphabet ={
"A" : ".-",
"B" : "-...",
"C" : "-.-.",
"D" : "-..",
"E" : ".",
"F" : "..-.",
"G" : "--.",
"H" : "....",
"I" : "..",
@wgaylord
wgaylord / input.json
Last active April 4, 2017 23:50 — forked from hansihe/input.json
{
"types": {
"u8": ["native", {
"type": "integer"
}],
"test": ["container", {
"virtual": true,
"fields": [
{
"name": "tag",
@wgaylord
wgaylord / get_available_memory.py
Created May 22, 2016 15:32 — forked from lukaskollmer/get_available_memory.py
Get memory stats in Pythonista using ctypes
#!/usr/bin/env python3
from ctypes import *
from objc_util import ObjCClass
NSProcessInfo = ObjCClass('NSProcessInfo')
NSByteCountFormatter = ObjCClass('NSByteCountFormatter')
class c_vm_statistics(Structure):
_fields_ = [('free_count', c_uint),
('active_count', c_uint),
@wgaylord
wgaylord / turtle.py
Created April 26, 2016 22:00 — forked from omz/turtle.py
turtle
# turtle.py
# Basic Turtle graphics module for Pythonista
#
# When run as a script, the classic Koch snowflake is drawn as a demo.
# The module can also be used interactively or from other scripts:
# >>> from turtle import *
# >>> right(30)
# >>> forward(100)
# ...
@wgaylord
wgaylord / image2base64.py
Created April 18, 2016 18:52 — forked from GuyCarver/image2base64.py
Pythonista image2base64
#covert an image in the clipboard to a 57x57 rgb icon and store base64 version of it into the clipboard.
#if an image is not in the clipboard the base64 string 'b64str' will be loaded and displayed.
#after running the 1st time replace the contents of b64str with the clipboard.
from PIL import Image
import clipboard
from StringIO import *
import base64
b64str="""
@wgaylord
wgaylord / Spellcheck word.py
Created March 22, 2016 05:03 — forked from omz/Spellcheck word.py
Spellcheck word.py
# coding: utf-8
from objc_util import ObjCClass
UITextChecker = ObjCClass('UITextChecker')
def check_word(word, lang='en_US'):
c = UITextChecker.new().autorelease()
check = c.rangeOfMisspelledWordInString_range_startingAt_wrap_language_
misspelled_range = check(word, (0, len(word)), 0, False, lang)
return (misspelled_range.location != 0)
package de.zh32.slp;
import com.google.gson.Gson;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;