Skip to content

Instantly share code, notes, and snippets.

View mangar's full-sized avatar
:octocat:
Working from home

Marcio Mangar mangar

:octocat:
Working from home
View GitHub Profile
#
# RED - Error
# GREEN - Success
# - Flashing: 1 or more problems
# - 2 Flashing in a row: requesting data
#
import mypi.led
import mypi.url
#
@mangar
mangar / ubuntu_change_date
Created January 10, 2018 11:56
How to change date and time on Ubuntu - The best way
ntpdate -s ntp.ubuntu.com
dpkg-reconfigure tzdata
@mangar
mangar / main.go
Created November 14, 2017 14:27
Screen Scraping in Go Lang
//
// Screen Scraping in Go Lang
//
// Lib:
// go get github.com/PuerkitoBio/goquery
//
package main
import (
"fmt"
@mangar
mangar / Makefile
Created August 17, 2017 02:39
Makefile for Go - Template
#
# Reference:
# https://pt.slideshare.net/RaPz1/build-golang-projects-properly-with-makefiles
#
BINARY=s3upload
VERSION=1.0.0
BUILD=`date +%FT%T%z`
HASH=`git rev-parse HEAD`
#!/usr/bin/ruby
#
# This script helps to deploy static content to a S3 bucket.
#
# Send the content from options[:dist_dir] to option[:bucket]
# Also apply the CACHE_CONTROL and EXPIRES header to the files.
# The params can be changed on CACHE_CONTROL_METADATA and EXPIRES_METADATA
# constants previously.
#
@mangar
mangar / Brewfile.rb
Last active July 19, 2017 18:10
Brewfile + Cask + Homebrew
#
# Brewfile
# https://robots.thoughtbot.com/brewfile-a-gemfile-but-for-homebrew
#
brew install cask
brew install git
brew install npm
brew install heroku
brew install openssl
@mangar
mangar / docker_time_sync.sh
Created April 28, 2017 14:27
Docker - Problems with Time sync - Americas/Sao_Paulo
# Define America/Sao_Paulo
echo America/Sao_Paulo >/etc/timezone; dpkg-reconfigure -f noninteractive tzdata
# Sync clock
docker run --rm --privileged mangar/rails-pg:5.0.2.1 hwclock -s
echo "Enjoy!"
@mangar
mangar / codigo.gs
Created January 24, 2017 12:20
[Google Drive - Spreadsheet] Read spreadsheet (+ tabs) compose and send email...
/**
function sendEmails() {
var sheet = SpreadsheetApp.getActiveSheet();
var startRow = 2; // First row of data to process
var numRows = 2; // Number of rows to process
// Fetch the range of cells A2:B3
var dataRange = sheet.getRange(startRow, 1, numRows, 2)
// Fetch values for each row in the Range.
@mangar
mangar / Dockerfile
Created November 10, 2016 17:34
# Starting from a directory (ARGV[0]) gets all PDF files and generate # an image for each page inside another directory (ARGV[1]). # During the process, a new pdf is generated for each page. # The third param (ARGV[2]) can set to 'true' to remote this middle pdf.
FROM mangar/rails-pg:5.0.0
# docker build -t mangar/rails-pg:5.0.0.1 .
MAINTAINER Marcio Mangar "marcio.mangar@gmail.com"
RUN apt-get update && apt-get install -y ghostscript
RUN gem install rails -v 5.0.0.1
@mangar
mangar / pipes.toarray.ts
Created October 5, 2016 18:22
ToArray Pipe for Angular2
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({name: 'toArray'})
export class ToArray implements PipeTransform {
transform(value: number, exponent: string[]): number {
let res = [];
for (let i = 1; i <= value; i++) {
res.push(i);
}
return res;