Skip to content

Instantly share code, notes, and snippets.

View rodkranz's full-sized avatar

Rodrigo Lopes rodkranz

View GitHub Profile
@rodkranz
rodkranz / convert-id_rsa-to-pem.sh
Created February 15, 2017 14:48
Convert id_rsa to pem file
# Convert
openssl rsa -in ~/.ssh/id_rsa -outform pem > id_rsa.pem
# Permission
chmod 700 id_rsa.pem
@rodkranz
rodkranz / bashrc
Last active June 22, 2018 22:23
Golang environment
# OS
# export GOOS=linux
# ROOT FILES
export GOROOT=/usr/local/go
# Define here your path of GO projects
export GOPATH=$HOME/Projects
# Export go project in terminal
export GOBIN=$GOPATH/bin
@rodkranz
rodkranz / ReadBigFileAndParse.go
Created January 16, 2017 01:24
Read big file and unmarshal in json
// Package main
// Copyright 2017 Kranz. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
/**
Test read file by chunks
➜ read ll
total 13241936
drwxr-xr-x 5 rlopes staff 170B 16 Jan 01:19 ./
@rodkranz
rodkranz / readFileByChunks.go
Created January 14, 2017 12:15
Read big file by chunk in go
// Copyright 2017 Kranz. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package main
import (
"os"
"log"
"io"
"bufio"
@rodkranz
rodkranz / backup.go
Created January 8, 2017 21:50
create a backup of files
// Copyright 2017 Kranz. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package main
import (
"os/exec"
"log"
"os"
"time"
@rodkranz
rodkranz / Gomotor.go
Last active December 27, 2016 17:13
WebHook to execute "git pull".
// Copyright 2016 Kranz. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package main
import (
"fmt"
"net/http"
"os/exec"
"log"
@rodkranz
rodkranz / PKGBUILD
Created December 23, 2016 09:26
Config for latest version of Spotify in Yaourt.
# Maintainer: Ashley Whetter <(firstname) @ awhetter.co.uk>
# Contributor: Eothred <[email protected]>
pkgname=spotify
pkgver=1.0.45.186
_anotherpkgver=.g3b5036d6
pkgrel=1
pkgdesc="A proprietary music streaming service"
arch=('x86_64' 'i686')
license=('custom:"Copyright (c) 2006-2010 Spotify Ltd"')
@rodkranz
rodkranz / git-commit-author-rewrite.md
Created December 21, 2016 10:56
Change the email address for a git commit.

Change the email address for a git commit.

$ git commit --amend --author="Author Name <[email protected]>"

or

$ git commit --amend --reset-author
@rodkranz
rodkranz / GitSlackBot.go
Created December 19, 2016 14:05
Send Github status in slack Raw
// Copyright 2016 rodkranz. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package main
import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
@rodkranz
rodkranz / ServerInc.go
Created December 19, 2016 14:04
Server count incrementer in go
// Copyright 2016 Kranz. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package main
import (
"net/http"
"fmt"
"runtime"
"log"