Skip to content

Instantly share code, notes, and snippets.

View iwootten's full-sized avatar

Ian Wootten iwootten

View GitHub Profile
@iwootten
iwootten / class-ghost.php
Created September 25, 2013 14:30
Changes made to the Wordpress Ghost export plugin to get it to write out
<?php
/**
* Plugin Name.
*
* @package Ghost
* @author Ghost Foundation
* @license GPL-2.0+
* @link http://ghost.org
* @copyright 2013 Ghost Foundation
*/
@iwootten
iwootten / server-patch.js
Last active December 23, 2015 21:59
Additions made to Ghosts server.js in order to enable proper upload to db importer
server.use('/ghost/debug/db/import/', express.multipart());
server.use('/ghost/debug/db/import/', express.multipart({uploadDir: __dirname + '/content/data'}));
@iwootten
iwootten / oiio_convert.py
Last active March 17, 2021 02:44
Simple Python OpenImageIO example
import OpenImageIO as oiio
buf = oiio.ImageBuf("Test_003_02_X1_0001.cr2")
cropped = oiio.ImageBuf()
extended = oiio.ImageBuf(oiio.ImageSpec (3693, 2077, 3, oiio.FLOAT))
resized = oiio.ImageBuf(oiio.ImageSpec (1920, 1080, 3, oiio.FLOAT))
oiio.ImageBufAlgo.crop(cropped, buf, oiio.ROI(108, 3801, 514, 2085), nthreads=4)
oiio.ImageBufAlgo.paste(extended, 0, 253, 0, 0, cropped, nthreads=4)
oiio.ImageBufAlgo.resize(resized, extended, nthreads=4)
oiio.ImageBufAlgo.render_text(resized, 1300, 1030, "00001.cr2", 50, "Arial")
@iwootten
iwootten / talk.py
Created April 26, 2015 08:13
Offspring wanted me to count to 1000000
import subprocess
for i in range(1, 1000001):
subprocess.call(["say", "%d" % i])
@iwootten
iwootten / start_docker_compose.sh
Created January 29, 2016 11:45
Use your docker-machine host ip as docker-compose environment variable
sed -e "s/DOCKER_HOST_IP/$(docker-machine ip your-machine-name)/g" docker-compose.yml | docker-compose --file - up
import time
import picokeypad as keypad
keypad.init()
keypad.set_brightness(1.0)
lit = 0
last_button_states = 0
colour_index = 0
from rgbkeypad import RGBKeypad
import time
keypad = RGBKeypad()
keypad.color = (0, 0, 0)
WHITE = (255, 255, 255)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
@iwootten
iwootten / freeze.txt
Last active November 29, 2021 18:02
List of Installed Python Packages on Raspberry Pi OS Bullseye
arandr==0.1.10
astroid==2.5.1
asttokens==2.0.4
automationhat==0.2.0
beautifulsoup4==4.9.3
blinker==1.4
blinkt==0.1.2
buttonshim==0.0.2
Cap1xxx==0.1.3
certifi==2020.6.20
@iwootten
iwootten / publish_lambda_layer.sh
Created January 27, 2022 13:49
Publishes Python Dependencies in a requirements.txt to a AWS Lambda Layer
REGION=eu-west-2
RUNTIME=python3.8
LAYER_NAME=scrapy
docker run -v $(pwd):/out -it lambci/lambda:build-$RUNTIME \
pip install -r /out/requirements.txt -t /out/build/$LAYER_NAME/python
cd build/$LAYER_NAME
zip -r ../../$LAYER_NAME.zip python/
cd ../..
@iwootten
iwootten / karol_example.py
Created March 4, 2022 14:26
Example of Accessing a Task within and Shot within and Episode
import ftrack_api
session = ftrack_api.Session()
result = session.query('select id from Task '
'where name is "Animation" '
'and project.full_name is "{0}" '
'and parent.parent.name is "{1}" '
'and parent.name is "{2}"'.format("Karol Example", "EP_05_TEST", 44))