Skip to content

Instantly share code, notes, and snippets.

View threeaccents's full-sized avatar

Rodrigo Lessa threeaccents

View GitHub Profile
@threeaccents
threeaccents / phantom_setup.sh
Created February 1, 2016 17:40
Install phantomjs 2 on ubunutu server
#!/bin/bash
wget https://github.com/Pyppe/phantomjs2.0-ubuntu14.04x64/raw/master/bin/phantomjs
sudo chmod 755 phantomjs
sudo mv phantomjs /usr/bin
@threeaccents
threeaccents / setup_selenium.sh
Last active February 17, 2016 20:07 — forked from curtismcmullan/setup_selenium.sh
Setup Selenium Server on Ubuntu 14.04
#!/bin/bash
# Following the guide found at this page
# http://programmingarehard.com/2014/03/17/behat-and-selenium-in-vagrant.html
echo "\r\nUpdating system ...\r\n"
sudo apt-get update
# Create folder to place selenium in
@threeaccents
threeaccents / golang_setup.sh
Last active March 26, 2016 02:56
install golang 1.6 on ubunutu
#!/bin/bash
sudo apt-get update
sudo apt-get install git
curl -O https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz
tar -xvf go1.6.linux-amd64.tar.gz
const spawnSync = require('child_process').spawnSync;
const defaultDestPath = __dirname + '/pdf';
function convertToPdf(filepath, destpath) {
var resp = {};
if (destpath == undefined) {
destpath = defaultDestPath;
}
@threeaccents
threeaccents / serial.go
Created September 8, 2016 17:33
goserial
package main
import (
"bytes"
"encoding/binary"
"flag"
"fmt"
"io"
"log"
"time"
@threeaccents
threeaccents / serial.ino
Created September 8, 2016 17:39
serialArd
#include <Servo.h>
Servo myservo;
void setup() {
Serial.begin(9600);
myservo.attach(9);
}
void loop() {
@threeaccents
threeaccents / smq.go
Last active January 9, 2018 01:09
Simple Message Queue
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.
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) {
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
sudo dnf install vips vips-tools vips-devel