Skip to content

Instantly share code, notes, and snippets.

Avatar

Kian Ryan kianryan

View GitHub Profile
@kianryan
kianryan / Makefile
Created Jul 25, 2022
Makefile for badgeroom
View Makefile
.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 Jul 25, 2022
Convert PBM to Bytearray
View convert_pbm.py
# 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 Apr 4, 2020
Lua script for Keybow Mini Keyboard for Darkroom Twitch Stream
View mini_darkroom.lua
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 Mar 17, 2020
tinygo demo for BBC MicroBit using accelerometer and matrix display
View accel_demo.go
package main
import (
"time"
"machine"
"image/color"
"tinygo.org/x/drivers/microbitmatrix"
"tinygo.org/x/drivers/mma8653"
)
@kianryan
kianryan / NerdCodeVim.json
Created Aug 30, 2018
Quick NERD Commenting for VS Code/VIM
View NerdCodeVim.json
"vim.normalModeKeyBindings": [
{
"before": ["<leader>", "c", "c"],
"commands": [
"editor.action.addCommentLine"
]
},
{
"before": ["<leader>", "c", "u"],
@kianryan
kianryan / xml-curl.sh
Created Jun 24, 2014
Post XML Payload from Curl
View xml-curl.sh
curl -k -X POST -d @filename.xml -H "Content-Type: application/xml" URL
@kianryan
kianryan / search_epub.sh
Created Apr 29, 2014
Search for a given word in a sentence in a collection of epubs
View search_epub.sh
for file in Terry*.epub; do echo $file; unzip -p "$file" | egrep -no '(\w+\s+)+force(\s+\w+)+'; done
View twitter_message.rb
require 'mechanize'
module CCCB::Core::TwitterMessage
extend Module::Requirements
TWITTER_REGEX = /twitter.com\/(?<name>[A-Za-z0-9_]*)\//i
needs :bot, :links
View twitter_message.rb
require 'mechanize'
module CCCB::Core::TwitterMessage
extend Module::Requirements
TWITTER_REGEX = /twitter.com\/(?<name>[A-Za-z0-9_]*)\//i
needs :bot, :links
@kianryan
kianryan / fk_checker.rb
Created Dec 28, 2013
EDMX Element Checker
View fk_checker.rb
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|