Skip to content

Instantly share code, notes, and snippets.

Jack Barker jibbius

View GitHub Profile
View simple-photo-booth.py
#!/usr/bin/env python
##################################
# Simple Raspberry Pi Photo Booth
##################################
# (for a more advanced photo booth, visit: https://github.com/jibbius/raspberry_pi_photo_booth)
#Imports
from time import sleep
import os, datetime, errno, picamera
@jibbius
jibbius / camera.py
Last active Apr 28, 2018
Attempt to add sound to photo booth
View camera.py
#!/usr/bin/env python
#Imports
import datetime
import os
from time import sleep
from PIL import Image
import RPi.GPIO as GPIO
import picamera
@jibbius
jibbius / picamera_sleep_demo.py
Created Aug 8, 2017
How to add a delay between the button press, and PiCamera taking a photo, using sleep().
View picamera_sleep_demo.py
from time import sleep
import RPi.GPIO as GPIO
import picamera
#... etc.
# Refer related gists, for how to setup the camera ...etc.
#Wait for someone to push the button
while True:
@jibbius
jibbius / Axure-RemoveAnnotations-Bookmarklet
Last active Jun 1, 2016
Add to your browser as a bookmarklet; Causes annotations within Axure wireframes to be removed.
View Axure-RemoveAnnotations-Bookmarklet
javascript:(function(){var iframe=document.getElementById('mainFrame');if(iframe){ var innerDoc=iframe.contentDocument || iframe.contentWindow.document; }else{ var innerDoc=document; } var head=innerDoc.getElementsByTagName('head')[0];var link=innerDoc.createElement('link');link.rel='stylesheet';link.type='text/css';link.href='https://rawgithub.com/jibbius/AxureReannotate/master/src/css/removeAnnotations.css';link.media='all';head.appendChild(link);})();
@jibbius
jibbius / Axure-Flatten.js
Last active Jun 1, 2016
Script that can be run from Inspector Console; Flattens Axure Wireframe site into a text file with hyperlinks to pages (can be side-loaded into other tooling if required).
View Axure-Flatten.js
// Get Sitemap
var axureNodes = $axure.document.sitemap.rootNodes;
// Parse sitemap for URLs
var key = 'url';
var normalisedAxureNodes = function getValues(obj, key) {
var objects = [];
for (var i in obj) {
if (!obj.hasOwnProperty(i)) continue;
if (typeof obj[i] == 'object') {
View Axure-Flatten-Bookmarklet
javascript:(function(){var axureNodes = $axure.document.sitemap.rootNodes;var key = 'url';var normalisedAxureNodes = function getValues(obj, key) { var objects = []; for (var i in obj) { if (!obj.hasOwnProperty(i)) continue; if (typeof obj[i] == 'object') { objects = objects.concat(getValues(obj[i], key)); } else if (i == key) { objects.push(obj[i]); } } return objects;}(axureNodes, key);var myfilecontents = function buildTextFile(my_values){ var textfilecontents = ''; for (var i in my_values) { if(my_values[i] != '') textfilecontents += 'http://' + window.location.hostname + '/' + my_values[i] + '\n'; } return textfilecontents;}(normalisedAxureNodes);var url = 'data:text;charset=utf8,' + encodeURIComponent(myfilecontents);window.open(url, '_blank');window.focus();})();
@jibbius
jibbius / Axure-Reannotate-Bookmarklet
Last active Jun 1, 2016
Add to your browser as a bookmarklet; Causes annotations within Axure wireframes to be numbered.
View Axure-Reannotate-Bookmarklet
javascript:(function(){var iframe=document.getElementById('mainFrame');var innerDoc=iframe.contentDocument || iframe.contentWindow.document;var head=innerDoc.getElementsByTagName('head')[0];var link=innerDoc.createElement('link');link.rel='stylesheet';link.type='text/css';link.href='https://rawgithub.com/jibbius/AxureReannotate/master/src/css/axureReannotate.css';link.media='all';head.appendChild(link);var annoID=1;var annoArray; var annoArray = new Array;jQuery('#mainFrame').contents().find('div.annnoteimage').each(function(){var that = jQuery(this);annoArray.push( [that.offset().top , that[0].id]);});annoArray.sort(function(a, b){return a[0]-b[0]});var anno;while(anno = annoArray.pop()){jQuery('#mainFrame').contents().find('#'+anno[1]).html('<INPUT VALUE=\''+(annoArray.length+1)+'\'></INPUT>');}})();
View nginx.conf
user www-data;
worker_processes 4;
worker_cpu_affinity 0001 0010 0100 1000;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
client_max_body_size 10m;
events {
worker_connections 2048;
}
View www.conf
; Start a new pool named 'www'.
; the variable $pool can we used in any directive and will be replaced by the
; pool name ('www' here)
[www]
; Per pool prefix
; It only applies on the following directives:
; - 'slowlog'
; - 'listen' (unixsocket)
; - 'chroot'
@jibbius
jibbius / full_example.html
Created May 16, 2013
jQuery - Expand & Collapse <div>s
View full_example.html
<html>
<head>
<title>Title</title>
<style type="text/css">body {background: rgb(253, 251, 207);}.fw_box {width: 430px;float: left;border-style: solid;border-width: 2px;border-radius: 10px;margin: 1px 10px 10px 10px;padding: 10px;position: inherit;border: 2px solid rgb(253, 250, 250);background-color: rgba(255, 255, 255, 0.5);color: #000000;}.fw_content {font-size: 0.8em;word-wrap: break-word;}.fw_box:hover .fw_content {display: block;overflow: auto;}.fw_title {font-size: 1.1em;text-align: center;vertical-align: middle;padding-top: 5px;font-weight: bold;}.fw_box:hover {background: rgba(255,165,165,0.5);}.fw_preview {float: right;width: 45%;height: 288px;background: white;margin: 10px;padding: 10px;border-style: solid;border-radius: 10px;}.fw_list {width: 100%;}.fw_row {width: 100%;overflow: auto;}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function(){
/*hide the all of the element with class f
You can’t perform that action at this time.