Skip to content

Instantly share code, notes, and snippets.

View perenecabuto's full-sized avatar

Felipe Ramos Ferreira (Cabuto) perenecabuto

View GitHub Profile
@perenecabuto
perenecabuto / push-auth-diagram
Last active February 8, 2017 06:21
push-auth-diagram.puml
@startuml
|user|
start
:open the app for the first time;
:click login button;
|mobile auth SDK|
:Check if there is an API AuthToken;
if (already have a token?) then
:YES;
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <linux/i2c-dev.h>
#include <fcntl.h>
#include <sys/ioctl.h>
static void
#!/usr/bin/env python
# coding: utf-8
import sys
import subprocess
import random
def main(msg):
out, err = subprocess.Popen('cowsay -l', shell=True, stdout=subprocess.PIPE).communicate()
@perenecabuto
perenecabuto / triangulate.js
Created July 28, 2016 22:47 — forked from alanchrt/triangulate.js
Triangulation of three points and radii
var distancePoints = function(p1, p2) {
// Find the distance between two points
return Math.sqrt(Math.pow(p2[0] - p1[0], 2) + Math.pow(p2[1] - p1[1], 2));
};
var intersectCircles = function (c1, r1, c2, r2) {
// Find the points of intersection for two circles
// Based on: http://stackoverflow.com/a/3349134
var d = distancePoints(c1, c2);
if (d > r1 + r2) // Circles do not overlap
@perenecabuto
perenecabuto / vpnc-connect.sh
Created June 26, 2015 04:04
vpnc-connect.sh
#!/usr/bin/env bash
lastdata="$HOME/.$(basename $0).db"
lastgateway="$(sed '1q;d' $lastdata)"
lastgroup="$(sed '2q;d' $lastdata)"
lastsecret="$(sed '3q;d' $lastdata)"
lastusername="$(sed '4q;d' $lastdata)"
echo -ne "gateway ($lastgateway): "
read gateway
@perenecabuto
perenecabuto / Install-sketchup-debian.sh
Last active August 29, 2015 14:21
Install-sketchup-debian.sh
#!/bin/bash
# http://ubuntuhandbook.org/index.php/2014/06/install-google-sketchup-ubuntu1404/
# http://help.sketchup.com/en/article/115548
# http://dl.trimble.com/sketchup/SketchUpMake-en.exe
# http://tech.gaeatimes.com/index.php/archive/how-to-make-wine-apps-match-your-gtk-theme/
INSTALL_FILE=/tmp/SketchUpMake-en.exe
DOWNLOAD_URL=http://dl.trimble.com/sketchup/SketchUpMake-en.exe
from geventwebsocket.handler import WebSocketHandler
from gevent.pywsgi import WSGIServer
from flask import Flask, request, render_template
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')