Skip to content

Instantly share code, notes, and snippets.

Avatar
🐘

Ammar Bandukwala ammario

🐘
View GitHub Profile
View mining-pool-blacklist.txt
178.63.211.58
198.50.152.135
144.217.94.65
213.32.53.176
145.239.232.114
80.218.217.199
78.24.235.244
213.32.53.176
167.99.229.57
51.38.99.97
@ammario
ammario / README.md
Last active Dec 11, 2018
gometalinter goland instructions
View README.md

Use this File Watcher configuration for gometalinter errors to appear as squiggles in your IDE.

Arguments

--vendor --fast --enable-gc --tests --aggregate --disable=gotype $FileDir$ --format="{{.Path}}:{{.Line}}: {{.Message}}"

Output filters

$FILE_PATH$:$LINE$:$MESSAGE$

@ammario
ammario / install_adminer.sh
Last active Jan 12, 2017
Install Adminer w/ Apache
View install_adminer.sh
#!/bin/bash
yum -y install httpd php php-mysql mariadb mariadb-server wget
sed -i 's/Listen 80/Listen 8080/g' /etc/httpd/conf/httpd.conf
service httpd restart
service mariadb restart
mkdir -p /var/www/html/
wget -O /var/www/html/adminer.php https://www.adminer.org/static/download/4.2.5/adminer-4.2.5-mysql.php
@ammario
ammario / install_go_latest.sh
Last active May 3, 2018
Install latest go CentOS
View install_go_latest.sh
#!/bin/bash
set -e
sudo yum -y install wget git
wget -O /tmp/go.tar.gz https://storage.googleapis.com/golang/go1.10.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf /tmp/go.tar.gz
ln -s /usr/local/go/bin/go /usr/bin/go
# Install glide
export GOPATH=~/go
mkdir -p ~/go/bin
@ammario
ammario / goth
Created Sep 2, 2016
golang test coverage html
View goth
#!/bin/bash
go test -coverprofile=coverage.out
go tool cover -html=coverage.out
@ammario
ammario / google_connect.go
Last active Aug 21, 2016
Connect to Google Cloud with logging
View google_connect.go
package main
import (
"github.com/stratexio/gclog"
"golang.org/x/net/context"
"google.golang.org/cloud"
"google.golang.org/cloud/storage"
)
@ammario
ammario / install_go.sh
Last active Sep 17, 2019
Install golang
View install_go.sh
#!/bin/bash
set -euf -o pipefail
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
rm -rf /usr/local/go || true
rm /usr/local/bin/go || true
@ammario
ammario / ipint.go
Created Jun 5, 2016
Golang ip <-> int conversion
View ipint.go
func ip2int(ip net.IP) uint32 {
if len(ip) == 16 {
return binary.BigEndian.Uint32(ip[12:16])
}
return binary.BigEndian.Uint32(ip)
}
func int2ip(nn uint32) net.IP {
ip := make(net.IP, 4)
binary.BigEndian.PutUint32(ip, nn)
View keybase.md

Keybase proof

I hereby claim:

  • I am ammario on github.
  • I am ammar (https://keybase.io/ammar) on keybase.
  • I have a public key ASCHuUmMssaRVYYIHqKdvCGN7rrhbz5qlq3vzZJF3ZU0EAo

To claim this, I am signing this object:

@ammario
ammario / connect_mysql.go
Last active Oct 15, 2016
Golang connect to MySQL
View connect_mysql.go
package main
import (
"database/sql"
_ "github.com/go-sql-driver/mysql"
)
func main() {
mysqlConn, err := sql.Open("mysql", os.Getenv("MYSQL_USER")+":"+os.Getenv("MYSQL_PASS")+"@("+os.Getenv("MYSQL_HOST")+")/"+os.Getenv("MYSQL_DB") + "?parseTime=true")
if err != nil {