I got added as a contributor in ~400 repositories in my organisation by accident. This JavaScript helped me undo that problem. Just head over to https://github.com/settings/repositories, change the logic for which repositories you want to leave and then run the leaveOne as many times as necessary.
| import os | |
| import pygame | |
| import time | |
| import random | |
| class pyscope : | |
| screen = None; | |
| def __init__(self): | |
| "Ininitializes a new pygame screen using the framebuffer" |
These Node-RED snippets accompany a blog post I wrote about using Docker and Node-RED on a Raspberry Pi to integrate IoT devices.
| <div class="progress" style="border: 1px solid #999"> | |
| <div id="progress-bar" style="border-right: ; background-color: #96f; height: 10px; width: 0%"></div> | |
| </div> | |
| <div id="countdown"></div> | |
| <script type="text/javascript"> | |
| function getDaysRemaining(endtime){ | |
| var t = Date.parse(endtime) - Date.parse(new Date()); | |
| var days = Math.floor( t/(1000*60*60*24) ); | |
| return days; |
These scripts will help you install Docker, Docker Compose, and Docker Machine.
Make sure you have jq available first.
| #!/usr/bin/env ruby | |
| require 'sinatra' | |
| require 'json' | |
| # set :bind, 'example.com' | |
| set :port, '80' | |
| get '/data.jsonp' do | |
| headers 'Access-Control-Allow-Origin' => 'http://example.com' |
| { | |
| "Wales": { | |
| "population": 2265125, | |
| "constituencies": [ | |
| "Aberavon", | |
| "Aberconwy", | |
| "Alyn & Deeside", | |
| "Arfon", | |
| "Blaenau Gwent", | |
| "Brecon & Radnorshire", |
| require 'net/http' | |
| require 'json' | |
| require 'fileutils' | |
| HTTP_PROXY = URI 'http://proxy:80' | |
| DOWNLOAD_DIRECTORY = 'gems' | |
| def http_connection(host, port, use_ssl, &block) | |
| proxy_connection = Net::HTTP::Proxy(HTTP_PROXY.host, HTTP_PROXY.port) |
| /*var sensor = require("HC-SR04").connect(C6,C7,function(dist) { | |
| console.log(dist+" cm away"); | |
| }); | |
| setInterval(function() { | |
| sensor.trigger(); // send pulse | |
| }, 500); | |
| */ | |
| SPI2.setup({baud:3200000, mosi:B15}); | |
| var rgb = new Uint8Array(50*3); |
This is a simple WebSockets app which demostrates how an event could be sent from one browser to another device's browser.
The code was adapted from Martyn Loughran's em-websocket tutorial article http://rubylearning.com/blog/2010/10/01/an-introduction-to-eventmachine-and-how-to-avoid-callback-spaghetti/ which was published as a Gist https://gist.github.com/mloughran/604404
The idea would be to eventually make it into a snippet which could be launched from a browser bookmarklet to add synchronisation between browsers on all kinds of devices.