Skip to content

Instantly share code, notes, and snippets.

View thiagozs's full-sized avatar
:octocat:
Have a nice day

Thiago Zilli Sarmento thiagozs

:octocat:
Have a nice day
View GitHub Profile
@thiagozs
thiagozs / golang_template_tips.md
Created August 1, 2023 15:50
Golang template tips

How to use Go text templates

October 20, 2021 7 min read2011

Using Golang Templates

Templates are files that define a specific pattern and give room for automation, be it a simple text file or an HTML file for a webpage. If it provides space for customization, it is a template.

You can write programming logic to parse simple templates, but as the level of customization in your template increases, the programming logic you need to customize increases, making it less feasible to write template parsing logic.

@thiagozs
thiagozs / install_zsh.sh
Created June 27, 2023 21:25
Install zsh script
#!/bin/bash
# Update package lists
sudo apt-get update
# Check if Zsh is installed, and if not, install it
if ! command -v zsh &> /dev/null
then
echo "Zsh is not installed. Installing..."
sudo apt-get install -y zsh
<!-- Game canvas -->
<canvas id="c"></canvas>
<!-- Gameplay HUD -->
<div class="hud">
<div class="hud__score">
<div class="score-lbl"></div>
<div class="cube-count-lbl"></div>
</div>
<div class="pause-btn"><div></div></div>
@thiagozs
thiagozs / eventemitter.go
Created May 29, 2023 19:13
Test case eventemitter golang chalenge
package eventemitter
import (
"fmt"
)
type Data func(data interface{})
var (
datas = make(map[string][]Data)
@thiagozs
thiagozs / bluetooth-reconnect
Created April 24, 2023 14:11 — forked from AndBondStyle/bluetooth-reconnect
Simple linux service for brute-force bluetooth auto-connection
#!/bin/bash
# Miminum delay between iterations, in seconds
delay=10
# Pairs of [bluetooth MAC, test expression]
targets=(
"98:B6:E9:47:F0:4F" "test ! -e /dev/input/js0"
"98:B6:E9:72:6C:31" "test -z \"\$(bluetoothctl info 98:B6:E9:72:6C:31 | grep 'Connected: yes')\""
)
@thiagozs
thiagozs / cosmos.sh
Created April 17, 2023 17:22
=Cosmos scripts bootstrap
#!/bin/bash
rm -r ~/.simapp
cd ~/workspace/cosmos-sdk
./build/simd tendermint unsafe-reset-all
./build/simd init demo
./build/simd keys --keyring-backend test add b9lab
./build/simd add-genesis-account --keyring-backend test b9lab 100000000stake
./build/simd gentx --keyring-backend test b9lab 70000000stake --chain-id $(jq -r '.chain_id' ~/.simapp/config/genesis.json)
./build/simd collect-gentxs
@thiagozs
thiagozs / keybase.md
Created April 14, 2023 17:33
Keybase proof

Keybase proof

I hereby claim:

  • I am thiagozs on github.
  • I am thiagozs (https://keybase.io/thiagozs) on keybase.
  • I have a public key ASApUHr6Hze-uyJtilGgWwKkkyIF0FSP5vnkelRxx0q2zwo

To claim this, I am signing this object:

@thiagozs
thiagozs / aws-lambda-calculator.go
Created March 15, 2023 21:09
AWS lambda calculator
package main
import (
"flag"
"fmt"
)
type Pricing struct {
Region string
PerRequestPrice float64 // in USD per 1 million requests
@thiagozs
thiagozs / docker_compose.yml
Last active February 17, 2023 20:38
Docker Compose postgre and pgadmin
version: '3.9'
services:
postgres:
container_name: postgres
image: postgres
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: secret
PGDATA: /data/postgres
@thiagozs
thiagozs / regexp_schema.go
Created December 13, 2022 14:11
Golang regexp parse schema.rb ruby database
package main
import (
"fmt"
"regexp"
)
func main() {
schema := `
ActiveRecord::Schema.define(version: 2022_12_05_175521) do