Skip to content

Instantly share code, notes, and snippets.

View rodkranz's full-sized avatar

Rodrigo Lopes rodkranz

View GitHub Profile
@rodkranz
rodkranz / proxy.go
Last active February 21, 2018 09:18
Simple proxy to add CORS at header in endpoint API.
// 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.
//
// Execute:
//
// $ ./go run main.go -target http://www.google.com
//
package main
@rodkranz
rodkranz / vote_boot.go
Last active December 7, 2016 10:25
Vote BlackMirror Bot
// 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 (
"encoding/json"
"fmt"
"github.com/Pallinder/go-randomdata"
"io/ioutil"
@rodkranz
rodkranz / rand_num.go
Last active December 7, 2016 10:25
Randon Number in Go
package main
import (
"time"
"math/rand"
)
func init() {
rand.Seed(time.Now().UTC().UnixNano())
}
@rodkranz
rodkranz / func_dynamic.go
Last active December 7, 2016 10:24
func with params dynamic
// 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"
"reflect"
)
@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"
@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 / 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@address.com>"

or

$ git commit --amend --reset-author
@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 <yngve.levinsen@gmail.com>
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 / 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 / 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"