Skip to content

Instantly share code, notes, and snippets.

View rof20004's full-sized avatar
🏠
Working from home

Rodolfo Azevedo rof20004

🏠
Working from home
  • NTT DATA
  • São Caetano do Sul, São Paulo
View GitHub Profile
@rof20004
rof20004 / go_queue_generics_example.go
Last active April 28, 2024 15:46
Go queue implementation with generics
package main
import (
"fmt"
)
type User struct {
Id int
Name string
}
@rof20004
rof20004 / queue_stack.go
Created March 9, 2024 11:32
queue and stack home made
// You can edit this code!
// Click here and start typing.
package main
import "fmt"
func enqueue(a []int, elem int) []int {
return append([]int{elem}, a...)
}
@rof20004
rof20004 / cidr.go
Created December 11, 2023 20:12
CIDR conflicts checker
package main
import (
"fmt"
"net"
)
func CIDRConflict(cidr1, cidr2 string) (bool, error) {
_, network1, err := net.ParseCIDR(cidr1)
if err != nil {
@rof20004
rof20004 / build docker multi arch
Last active November 18, 2023 13:35
Mac M1 - Build docker image multi arch and push to docker hub
docker buildx build --platform=linux/amd64,linux/arm64,linux/arm/v7 -t account/image_name:tag --push .
@rof20004
rof20004 / calculate_diff_dates.go
Created April 22, 2021 23:16
Calculate difference in days, hours, minutes and seconds of two dates
// Golang program for Calculating the total number
// of Hours, Days, Minutes and Seconds
// between two dates
package main
import (
"fmt"
"time"
)
@rof20004
rof20004 / undo_previous_apt_get_install.sh
Last active April 1, 2020 18:54
Undo previous apt-get install
#!/bin/bash
apt purge $(grep "Install:" /var/log/apt/history.log | tail -n 1 | tr " " "\n" | grep -E ":amd64|:i386|:arm" | tr "\n" " ")
@rof20004
rof20004 / monitor_connections_to_port
Last active March 22, 2020 03:41
Linux command to check how many connections are established in port
watch -n 0.1 "netstat -anp | grep :8082 | grep ESTABLISHED | wc -l"
@rof20004
rof20004 / convert_binary_text.go
Last active March 9, 2024 11:39
Go example to convert binary to text and text to binary
package main
import (
"fmt"
"strconv"
"strings"
)
func textToBinary(s string) string {
var b string