Skip to content

Instantly share code, notes, and snippets.


Rodrigo Lessa threeaccents

View GitHub Profile
View cancel.go
func (s *Service) ChunkUpload(ctx context.Context, r *multipart.Reader) error {
chunk, err := s.parseChunk(r)
if err != nil {
return fmt.Errorf("failed parsing chunk %w", err)
// checkpoint
select {
case <-ctx.Done():
// Abort / return early
View date.js
export default {
subtract(date, days) {
return this.add(date, -days);
add(date, days) {
const result = new Date(date);
result.setDate(result.getDate() + days);
return result;
addMonths(date, months) {
threeaccents / smq.go
Last active Jan 9, 2018
Simple Message Queue
View smq.go
package smq
//SMQ is the main controller for the queue.
type SMQ struct {
jobQueue chan []byte
consumer chan Message
worker chan int
//New takes in the max queue size and workers.
View serial.ino
#include <Servo.h>
Servo myservo;
void setup() {
void loop() {
View serial.go
package main
import (
View node-loffice.js
const spawnSync = require('child_process').spawnSync;
const defaultDestPath = __dirname + '/pdf';
function convertToPdf(filepath, destpath) {
var resp = {};
if (destpath == undefined) {
destpath = defaultDestPath;
threeaccents / openbrowser.go
Created Feb 25, 2016
open chrome browser with golang function
View openbrowser.go
// openBrowser tries to open the URL in a browser,
// and returns whether it succeed in doing so.
func openBrowser(url string) bool {
var args []string
switch runtime.GOOS {
case "darwin":
args = []string{"open"}
case "windows":
args = []string{"cmd", "/c", "start"}
threeaccents /
Created Feb 1, 2016
Install phantomjs 2 on ubunutu server
sudo chmod 755 phantomjs
sudo mv phantomjs /usr/bin
threeaccents /
Last active Mar 26, 2016
install golang 1.6 on ubunutu
sudo apt-get update
sudo apt-get install git
curl -O
tar -xvf go1.6.linux-amd64.tar.gz
threeaccents /
Last active Feb 17, 2016 — forked from curtismcmullan/
Setup Selenium Server on Ubuntu 14.04
# Following the guide found at this page
echo "\r\nUpdating system ...\r\n"
sudo apt-get update
# Create folder to place selenium in
You can’t perform that action at this time.