Skip to content

Instantly share code, notes, and snippets.

@piuggi
piuggi / example.md
Created September 3, 2015 20:30
Take A Screenshot of a VirtualBox Machine via commandline

VBoxManage controlvm screenshotpng

@piuggi
piuggi / gcloud_log.sh
Created May 5, 2015 20:01
gcloud deploy log 5/4/15
null:Sites cpiuggi$ git clone https://github.com/Method-Inc/method-dev-sigin.git
Cloning into 'method-dev-sigin'...
Username for 'https://github.com': ^C
null:Sites cpiuggi$ git clone https://github.com/Method-Inc/method-dev-sigin.git
Cloning into 'method-dev-sigin'...
Username for 'https://github.com': piuggi
Password for 'https://piuggi@github.com':
remote: Counting objects: 28, done.
remote: Total 28 (delta 0), reused 0 (delta 0), pack-reused 28
Unpacking objects: 100% (28/28), done.
@piuggi
piuggi / geo-weather.js
Created March 8, 2015 23:28
Get Location and Weather by Lat Long
var geocoderProvider = 'google';
var httpAdapter = 'http';
var geocoder = require('node-geocoder').getGeocoder(geocoderProvider, httpAdapter, {});
var weather = require('weather-js');
geocoder.reverse(40.7208628, -74.0455604, function(err, res) {
console.log(res);
weather.find({search: res[0].zipcode, degreeType: 'F'}, function(err, result) {
@piuggi
piuggi / makeGif.js
Created March 7, 2015 23:13
Looping Text Gif with Node.js using node-canvas gifencoder
var Canvas = require('canvas'),
GIFEncoder = require('gifencoder'),
fs = require('fs'),
path = require('path');
var width = 500, height = 500;
var encoder = new GIFEncoder(width, height);
encoder.createReadStream().pipe(fs.createWriteStream('myanimated.gif'));
@piuggi
piuggi / .gitignore
Last active August 29, 2015 14:14 — forked from jmsaavedra/.gitignore
###################################
# general ignore patterns
###################################
build/
obj/
*.o
Debug*/
Release*/
*.mode*
@piuggi
piuggi / gist:8261261db1aa531165a3
Created December 23, 2014 08:15
Update all documents in mongo a collection with an index
// where db.collection = the mongo collection you are looking to update
// this could be adapted in many ways
var collection = db.collection; var i = 0; collection.find().forEach(function(doc){ print("updating index: "+i); collection.update({_id:doc._id},{$set:{index:i}}); i++ })
@piuggi
piuggi / gist:297219af5870efde4422
Created August 27, 2014 16:20
ffserver.conf Cannon T3
Port 8090
BindAddress 0.0.0.0
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 5000
CustomLog -
NoDaemon
<Feed feed1.ffm>
File /tmp/feed1.ffm
@piuggi
piuggi / gist:3abf34bb0aa086668c67
Last active August 29, 2015 14:05
rPi | node.js, wiringPi, gphoto2 and ffmpeg install
cd ~
wget http://nodejs.org/dist/v0.10.28/node-v0.10.28-linux-arm-pi.tar.gz
tar -xvzf node-v0.10.28-linux-arm-pi.tar.gz
cd ~
touch .bash_profile
nano .bash_profile
#Node Source
#rPi IMAGE COPY AND RESTORE
#see all volumes mounted to machine
$ diskutil list
#locate your SD card
#change {N} your disk number
#unmount the disk you’re speaking to
@piuggi
piuggi / AWS_NODE_FOREVER_SETUP.md
Last active December 30, 2015 20:19
AWS Ubuntu 13.10 Setup Install for Node.js/Forever w. port forwarding for 80 Supports server reboots etc...

###AWS SERVER CONFIGURATION ####Configuring an Ubuntu AWS Box with Node, Mongodb, and Forever with port forwarding

  • Login to aws.amazon.com and create an EC2 instance with a standard Ubuntu installation.
  • Create a Security Group that allows type SSH on port 22 and HTTP on port 80.
  • Download the .pem file (during setup) which we'll use to authenticate into your server via terminal.

Modify permissions on the .pem file downloaded from AWS

$ chmod 0600 ~/Downloads/{your_key}.pem