Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Nilton Oliveira jniltinho

🏠
Working from home
View GitHub Profile
View map_struct.go
package main
import (
"database/sql"
"encoding/json"
"errors"
"fmt"
"log"
"reflect"
"strings"
@jniltinho
jniltinho / cache_redis.go
Last active March 14, 2023 10:19
SQL to Redis in JSON
View cache_redis.go
package main
import (
"context"
"encoding/json"
"log"
"time"
"github.com/go-redis/redis/v8"
)
@jniltinho
jniltinho / Server.go
Last active March 14, 2023 09:12
Exemple Golang Server Using TCP or Unix Socket
View Server.go
package main
import (
"fmt"
"net"
"os"
)
type Server struct {
protocol string
@jniltinho
jniltinho / main.go
Last active March 12, 2023 20:53
Criando um socket para o Postfix com Golang
View main.go
package main
import (
"fmt"
"net"
"os"
)
func handleConnection(conn net.Conn) {
// Handle incoming connection from Postfix
@jniltinho
jniltinho / install-ctfreak.sh
Created January 25, 2023 12:28
Install Ctfreak Server on Ubuntu 22.04
View install-ctfreak.sh
#!/bin/bash
## Install Ctfreak Server
## run as root
## https://ctfreak.com/
## https://ctfreak.com/docs/install/linux
FQDN=task.linuxpro.com.br
DOMAIN=linuxpro.com.br
apt-get update
@jniltinho
jniltinho / install-drone-server.sh
Last active January 6, 2023 16:07
Install Drone Server
View install-drone-server.sh
#!/bin/bash
## Install Drone Server
# https://docs.drone.io/server/provider/github/
# https://docs.drone.io/runner/exec/installation/linux/
# https://samuelsson.dev/how-to-install-and-configure-drone-ci-on-a-self-hosted-server/
# https://www.nginx.com/blog/using-free-ssltls-certificates-from-lets-encrypt-with-nginx/
# https://www.digitalocean.com/community/tutorials/how-to-use-certbot-standalone-mode-to-retrieve-let-s-encrypt-ssl-certificates-on-ubuntu-22-04
COMPOSE=https://github.com/docker/compose/releases/latest/download/docker-compose-linux-x86_64
@jniltinho
jniltinho / get-jira-id.go
Last active September 22, 2022 17:26
Regex Jira ID Golang
View get-jira-id.go
package main
// go mod init get-jira-id
// gofmt -w main.go
// go build -ldflags="-s -w"
// upx --best --lzma get-jira-id
// ./get-jira-id --issue=feature/Pbo-784-epic
import (
"flag"
@jniltinho
jniltinho / insatll-glassfish.sh
Last active September 15, 2022 21:00
Install GlassFish 5 CentOS 8
View insatll-glassfish.sh
#!/bin/bash
## Install GlassFish 5 64Bits on Linux (CentOS 8)
## https://www.oracle.com/br/java/technologies/javase/javase8-archive-downloads.html
## https://stackoverflow.com/questions/50374321/why-cant-access-to-glassfish-admin-console-remotely
## https://stackoverflow.com/questions/41974198/glassfish-change-admin-password
## https://www.osradar.com/how-to-install-glassfish-5-on-rhel-and-centos-8/
## https://linuxways.net/centos/how-to-install-glassfish-on-centos-8/
## https://www.rosehosting.com/blog/how-to-install-glassfish-5-on-centos-7/
## https://gist.github.com/sdmcraft/2c5abbdeccf37e1642e5
@jniltinho
jniltinho / install-nginx-pagespeed.sh
Last active June 29, 2022 16:12
Install Pagespeed Nginx
View install-nginx-pagespeed.sh
#!/bin/bash
## Install PageSpeed Ubuntu 20.04
## Run as root (sudo su)
## https://www.howtoforge.com/how-to-install-nginx-with-google-pagespeed-on-ubuntu-20-04/
## https://www.linuxbabe.com/nginx/compile-the-latest-nginx-with-ngx_pagespeed-module-on-ubuntu
## https://www.techrepublic.com/article/how-to-install-the-latest-version-of-nginx-on-ubuntu-server-18-04/
## https://www.tecmint.com/install-ngx_pagespeed-to-optimize-nginx-performance-on-ubuntu/
## nginx -v