Skip to content

Instantly share code, notes, and snippets.

@goliatone
goliatone / readme.md
Created March 8, 2016 22:21
Using a Raspberry Pi + Camera Board as a high resolution IP Camera

Making an IP camera with the Raspberry Pi

Requirements

  • Raspberry Pi (512MB rev2 recommended)
  • Raspberry Pi Camera board
  • SD Card (min 2BG, 8GB recommended for good measure. Class 10)

Optionally, a wifi adapter verified to work with raspberry pi ( I used Edimax Wireless Nano USB Adapter - http://www.amazon.com/gp/product/B005CLMJLU/ )

#!/bin/bash
# script to set Pi hostname based on MAC (or Serial number)
# 2015-02-22
# This script should be run as root (or with sudo) to change names
# If run by a user it will report changes, but will NOT implement them
PDIR="$(dirname "$0")"
CURRENT_HOSTNAME=$(cat /etc/hostname)
MAC=$(cat /sys/class/net/eth0/address)
# NOTE the last 6 bytes of MAC and CPUID are identical
package main
import (
"bytes"
"encoding/json"
"flag"
"io/ioutil"
"net"
"net/http"
"os"
@goliatone
goliatone / getip.go
Last active June 11, 2017 20:25 — forked from jniltinho/myip.go
Get My IP Golang
package main
import (
"net"
"log"
"os"
)
func main(){
ifaces, _ := net.Interfaces()
@goliatone
goliatone / 0main.md
Created February 11, 2016 19:17 — forked from canton7/0main.md
Local versions of tracked config files

How to have local versions of tracked config files in git

This is a fairly common question, and there isn't a One True Answer.

These are the most common techniques:

If you can modify your application

@goliatone
goliatone / reduce-size.dockerimage
Created February 8, 2016 18:15 — forked from NikoWoot/reduce-size.dockerimage
Reduce size of Docker image
=================================================
After software installation
=================================================
RUN apt-get clean
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
=================================================
Docker on build process, include all files on directory build (include .git with old build)
Solution for reduce size of docker image (but for reuse is not good solution)
=================================================
@goliatone
goliatone / using-raw-socket-io-in-sails.js
Created January 14, 2016 18:38 — forked from mikermcneil/using-raw-socket-io-in-sails.js
Using raw socket.io functionality in a Sails.js controller
module.exports = {
/**
*
* Using raw socket.io functionality from a Sails.js controller
*
*/
index: function (req,res) {
@goliatone
goliatone / rPrint example.txt
Created December 4, 2015 04:33 — forked from stuby/rPrint example.txt
This is a handy recursive data printer.
> rPrint({first={true,1.3,"abc",{1,2,5}},22,33,last={nil,5},2},nil,"Junk")
Junk table
Junk [1] number 22
Junk [2] number 33
Junk [3] number 2
Junk [last] table
Junk [last] [2] number 5
Junk [first] table
Junk [first] [1] boolean true
Junk [first] [2] number 1.3
var googleapi = {
authorize: function(options) {
var deferred = $.Deferred();
//Build the OAuth consent page URL
var authUrl = 'https://accounts.google.com/o/oauth2/auth?' + $.param({
client_id: options.client_id,
@goliatone
goliatone / _Pebble controlled NeoPixels using ESP8266.md
Created November 28, 2015 04:47 — forked from ajfisher/_Pebble controlled NeoPixels using ESP8266.md
Using a pebble watch to control NeoPixel (WS2812 ) LEDs via an ESP8266 controller