Skip to content

Instantly share code, notes, and snippets.

View carlosvega20's full-sized avatar

Carlos Vega carlosvega20

  • San Francisco, CA
View GitHub Profile
//Simulation
var world = {gravity: 9.8, intervalTime: 100, verticalLimit: 600, dt: 0.1}
function simulation (obj) {
var t = 0, top = 0;
var interval = setInterval(function () {
if(top>world.verticalLimit) clearInterval(interval);
top += (world.gravity*obj.mass)*t;
obj.el.style.top = top+"px";
t += world.dt;
@carlosvega20
carlosvega20 / .js
Created September 24, 2015 21:56 — forked from hzhu/.js
Data Transformation
var x = [ {node: "ip2", app: "dbsyncer", containerId: "1234"},
{node: "ip2", app: "logforwa", containerId: "3423"},
{node: "ip4", app: "dbsyncer", containerId: "2213"},
{node: "ip4", app: "logforwa", containerId: "3434"} ]
var newObj = {};
x.forEach(function (item) {
newObj[item.node] = newObj[item.node] || [];
@carlosvega20
carlosvega20 / rpio_python_init_sh
Last active August 29, 2015 14:26
Configure Rasperry Pi, I2C and The RPi.GPIO Python Library
#!/bin/bash
#You need to enable i2c port
#sudo raspi-config
# Choose option: (8) Advanced Options
# A7 I2C and then enable yes.
#sudo reboot
#Update and install python rpi
sudo apt-get update
sudo apt-get dist-upgrade