Skip to content

Instantly share code, notes, and snippets.

View w4ilun's full-sized avatar
🤖

w4ilun w4ilun

🤖
View GitHub Profile
@w4ilun
w4ilun / mraa-install.sh
Created August 11, 2016 16:02
mraa-install.sh
#!/bin/bash
#Installing Mraa
clear
echo "Beginning install!"
sleep 1
mkdir buildMraa
cd buildMraa
checkCmake="1"
#Check if Cmake exists
@w4ilun
w4ilun / blinkWithSocketsNgrok.js
Last active July 6, 2016 01:53
ngrok version of blinkWithSockets.js
var m = require('mraa'); //IO Library
var app = require('express')(); //Express Library
var server = require('http').Server(app); //Create HTTP instance
var ngrok = require('ngrok'); //ngrok
var engine = require('express-dot-engine'); //Template engine
var io = require('socket.io')(server); //Socket.IO Library
var blinkInterval = 1000; //set default blink interval to 1000 milliseconds (1 second)
var ledState = 1; //set default LED state
@w4ilun
w4ilun / index.dot
Created July 6, 2016 01:45
dot template
<html>
<head>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.socket.io/socket.io-1.2.1.js"></script>
<script>
$(function(){
var socket = io.connect('[[= model.url]]');
$('#slider').on('input change',function(){
socket.emit('changeBlinkInterval',$(this).val());
});
@w4ilun
w4ilun / joystick.js
Created June 17, 2016 01:03
mocute bluetooth joystick mappings
var HID = require('node-hid');
var devices = HID.devices();
var joystick;
var map = {
26 : 'up',
27 : 'down',
4 : 'left',
7 : 'right',
0 : 'center',
28 : 'x',
var childProcess = require('child_process');
//take a snapshot using the webcam with ffmpeg
childProcess.exec('/home/root/bin/ffmpeg/ffmpeg -loglevel panic -y -s 320x240 -f video4linux2 -i /dev/video0 -vframes 1 ./capture.jpeg');
/***********************************************************
ffmpeg flags:
* -loglevel - set the logging level used by the library
* -y - overwrite output files without asking
* -s - set frame size WxH
* -f - force format
@w4ilun
w4ilun / gist:ee4a44fd932399e341b0dac91b4fa727
Last active May 1, 2016 23:30
Permission denied when opening serial device - Remember to logout and login again after
$ sudo usermod -a -G dialout <username>
@w4ilun
w4ilun / ProMicroTXRXLEDRemap
Last active January 24, 2025 03:38
Using the TX/RX LEDs as extra pins on the Pro Micro
The TX/RX LEDs on the Pro Micro uses the pins PD5 and PB0.
You can remove the resistors and use these pins, but you will need to first redefine the TXLED/RXLED pins.
In OS X:
/Users/USERNAME/Library/Arduino15/packages/SparkFun/hardware/avr/1.1.3/variants/promicro/pins_arduino.h
Change these values:
#define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0)
#define TXLED0 PORTD |= (1<<5)
#define TXLED1 PORTD &= ~(1<<5)
@w4ilun
w4ilun / start_stream.sh
Created October 25, 2015 01:33
start ffserver and ffmpeg
./ffserver &
./ffmpeg -r 25 -s 640x480 -f video4linux2 -i /dev/video0 http://localhost:8090/feed1.ffm
@w4ilun
w4ilun / ffserver.conf
Created October 25, 2015 01:31
ffserver config file for Intel Edison
HTTPPort 8090
# bind to all IPs aliased or not
HTTPBindAddress 0.0.0.0
# max number of simultaneous clients
MaxClients 1000
# max bandwidth per-client (kb/s)
MaxBandwidth 10000
<Feed feed1.ffm>
File /tmp/feed1.ffm
<html>
<head>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.socket.io/socket.io-1.2.1.js"></script>
<script>
$(function(){
var socket = io.connect('http://INTEL_EDISON_IP_ADDRESS:3000');
var temperature = $('#temperature');
socket.on('temperature',function(data){
temperature.html(data.celsius);