Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

var fs = require('fs');
var button_gpio = 17; // maps to digital PIN5 on the board
var led_gpio = 27; // maps to digital PIN7
var fileOptions = {encoding: 'ascii'};
var exportGpio = function(gpio_nr) {
fs.writeFile('/sys/class/gpio/export', gpio_nr, fileOptions, function (err) {
if (err) { console.log("Couldn't export %d, probably already exported.", gpio_nr); }
@isma44
isma44 / macros.h
Last active August 29, 2015 14:06 — forked from holachek/macros.h
// super awesome Arduino-like pin macros save you from having to remember bitmasks
// code from Matthew T. Pandina's Demystifying the TLC5940 tutorial:
// URL: https://sites.google.com/site/artcfox/demystifying-the-tlc5940
#define setOutput(ddr, pin) ((ddr) |= (1<< (pin)))
#define setLow(port, pin) ((port) &= ~(1 << (pin)))
#define setHigh(port, pin) ((port) |= (1 << (pin)))
#define outputState(port, pin) ((port) & (1 << (pin)))
#define pulse(port, pin) do { \
setHigh((port), (pin)); \
@isma44
isma44 / main.c
Last active August 29, 2015 14:06 — forked from holachek/main.c
#define LEDPORT PORTD
#define LEDBIT PD6
#define LEDDDR DDRD
#include <avr/io.h>
int main (void)
{
LEDDDR |= (1 << LEDBIT); // set LED pin as an output
TCCR1B |= ((1 << CS10) | (1 << CS11)); // configure timer prescaling
@isma44
isma44 / gist:9c1d19e646afb68d9f0e
Created February 21, 2015 07:09
Ricoh Theta Test by Node.js
// for Mac
// module.paths.push('/usr/local/lib/node_modules');
var Theta = require('ricoh-theta');
var theta = new Theta();
theta.connect('192.168.1.5');
// capture
theta.on('connect', function(){
@isma44
isma44 / gist:64038cc6296ea8becf2d
Last active September 5, 2015 00:29 — forked from rais38/gist:4683817
Embed YouTube videos with UIWebView
#pragma mark - Embed Video
- (UIWebView *)embedVideoYoutubeWithURL:(NSString *)urlString andFrame:(CGRect)frame {
NSString *videoID = [self extractYoutubeVideoID:urlString];
NSString *embedHTML = @"\
<html><head>\
<style type=\"text/css\">\
body {\
background-color: transparent;\
@isma44
isma44 / keybase.md
Created September 13, 2019 02:56
keybase.md

Keybase proof

I hereby claim:

  • I am isma44 on github.
  • I am morije (https://keybase.io/morije) on keybase.
  • I have a public key ASDI8Ed5qY0I0nbNiiKdsy_n0neRdUb5lVLv9U9DsGixMAo

To claim this, I am signing this object: