Skip to content

Instantly share code, notes, and snippets.

View kianryan's full-sized avatar

Kian Ryan kianryan

View GitHub Profile
@kianryan
kianryan / Makefile
Created July 25, 2022 10:48
Makefile for badgeroom
.DEFAULT_GOAL := send_app
PORT=/dev/ttyS4
PYBOARD=tools/pyboard.py
PYTHON=python3
send_app:
$(PYTHON) $(PYBOARD) -d $(PORT) -f cp badge/*.py :
@kianryan
kianryan / convert_pbm.py
Created July 25, 2022 10:30
Convert PBM to Bytearray
# Convert image to bytes
#!/usr/bin/env python
import sys
import os
def main():
if len(sys.argv) != 2:
usage()
return 2
@kianryan
kianryan / mini_darkroom.lua
Created April 4, 2020 15:44
Lua script for Keybow Mini Keyboard for Darkroom Twitch Stream
require "keybow"
-- MACRO controls for darkroom Twitch.
-- SHIFT 0 (RED)
-- Middle Button : You awake...
-- Right Button : Because it's dark ..
-- SHIFT 1 (GREEN)
-- Middle Button : You go in a direction...
@kianryan
kianryan / accel_demo.go
Created March 17, 2020 12:20
tinygo demo for BBC MicroBit using accelerometer and matrix display
package main
import (
"time"
"machine"
"image/color"
"tinygo.org/x/drivers/microbitmatrix"
"tinygo.org/x/drivers/mma8653"
)
@kianryan
kianryan / NerdCodeVim.json
Created August 30, 2018 11:05
Quick NERD Commenting for VS Code/VIM
"vim.normalModeKeyBindings": [
{
"before": ["<leader>", "c", "c"],
"commands": [
"editor.action.addCommentLine"
]
},
{
"before": ["<leader>", "c", "u"],
@kianryan
kianryan / fk_checker.rb
Created December 28, 2013 12:56
EDMX Element Checker
require 'rexml/document'
edmx = File.read(ARGV.first)
doc = REXML::Document.new(edmx)
mapped = []
constrained = []
doc.elements.each('edmx:Edmx/edmx:Runtime/edmx:ConceptualModels/Schema/Association') do |ele|
@kianryan
kianryan / geocoding.cs
Last active December 22, 2015 21:59
Google Geocoding Example API v3
public void GoogleGeoCode(string address, out double lat, out double lon)
{
string url = "http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=" + address;
var req = (HttpWebRequest)WebRequest.Create(url);
var reader = new StreamReader(req.GetResponse().GetResponseStream());
var body = reader.ReadToEnd();
lat = double.Parse(Regex.Match(body, @"""lat\"" : ([\d\.]+)").Groups[1].Value);
@kianryan
kianryan / headerfooter.html
Created August 21, 2013 17:05
CSS/HTML Header Footer Demo
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Test2</title>
<style type="text/css" media="all">
div.page {
@kianryan
kianryan / soapclient_debug
Created July 15, 2013 13:55
SOAPClient Debug
echo "====== REQUEST HEADERS =====" . PHP_EOL;
var_dump($client->__getLastRequestHeaders());
echo "========= REQUEST ==========" . PHP_EOL;
var_dump($client->__getLastRequest());
echo "========= RESPONSE =========" . PHP_EOL;
var_dump($response);
@kianryan
kianryan / gist:3424744
Created August 22, 2012 11:43
WTF Twitter
C:\Users\kian>tracert www.twitter.com
Tracing route to twitter.com [199.59.148.10]
over a maximum of 30 hops:
1 <1 ms <1 ms <1 ms 172.16.155.2
2 * * * Request timed out.
3 * * * Request timed out.
4 * ^C