Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View wgaylord's full-sized avatar

William Gaylord wgaylord

View GitHub Profile
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;
@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)
@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 / 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 / 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),
# coding: utf-8
import urllib
import shutil
import zipfile
from jawa import ClassFile
import hashlib
import jawa
import json
import os
import sys
------------------------------------------------------------
C:\Python27\Scripts\pip run on 09/14/16 12:31:52
Downloading/unpacking Pillow
Getting page https://pypi.python.org/simple/Pillow/
URLs to search for versions for Pillow:
* https://pypi.python.org/simple/Pillow/
Analyzing links from page https://pypi.python.org/simple/pillow/
Skipping link https://pypi.python.org/packages/00/15/e776f42afb6d79f27710aded08fd50998174f772621f1cda5d44701be1ed/Pillow-2.1.0-py2.6-win32.egg#md5=0a85404ffb50fff762615a47e6d363e9 (from https://pypi.python.org/simple/pillow/); unknown archive format: .egg
Skipping link https://pypi.python.org/packages/00/5a/1807a6341c47d04211ae71e2bdf339ef42bea99429d0fc5f61cf7f57d53d/Pillow-2.8.0-py2.7-win-amd64.egg#md5=48a7745755452bd606d86f951782258b (from https://pypi.python.org/simple/pillow/); unknown archive format: .egg
Skipping https://pypi.python.org/packages/00/8b/855afd7da1bb8ec8fb02886834ebb37b766e9ecbc6abe000ae7960ddcaf5/Pillow-2.8.1-cp34-cp34m-macosx_10_6_intel.
@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 / ImageMaker.py
Created April 24, 2017 20:28
ImageMaker.py
from PIL import Image
def fix(pixel,d):
r =pixel[0]
g=pixel[1]
b=pixel[2]
factor=d/((r+b+g)/4.0)
return (int(r*factor),int(g*factor),int(b*factor))
def make(bw,color,size,scale):
@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" : "..",