Skip to content

Instantly share code, notes, and snippets.

View kardolus's full-sized avatar
🔥
crushing it

Guillermo Kardolus kardolus

🔥
crushing it
View GitHub Profile
@kardolus
kardolus / gist:d0a93bff8bdabf4b9d5360ecf259d2ee
Created June 11, 2023 19:52
Apple script for ChatGPT interaction
tell application "System Events"
keystroke "a" using {command down}
delay 0.1
keystroke "c" using {command down}
delay 0.1
key code 122 using {command down} -- the F1 key
end tell
@kardolus
kardolus / goland
Created November 15, 2022 16:03
IntelliJ scripts
#!/bin/sh
open -na "GoLand.app" --args "$@"
package postgres
import (
"database/sql"
"github.com/lib/pq"
"time"
)
type TransactionRecord struct {
ID string `db:"id"`
@kardolus
kardolus / application.yml
Last active November 11, 2020 21:37
Sam jamsession
cors:
whitelist:
- https://localhost:3000
- https://marketplug.app
alpaca:
schedule:
start: 9
close: 19
@kardolus
kardolus / bitmask_runes.go
Created October 11, 2020 13:59
Sometimes you need to convert runes to an index in an []int with size 26. And you need to convert back.
func rune2Index(r rune) int {
return int(r) - int('a')
}
func index2Rune(i int) rune {
return rune(i) + 'a'
}
package client_test
import (
"math"
"testing"
)
func TestUnitClient(t *testing.T) { // go test will hit this method
t.Run("Client Test", testClient)
}
### Usage: kong.sh [--no-db]
###
### - Run kong with an in memory database
### kong.sh --no-db
###
### - Run kong with postgre
### kong.sh
print_usage() {
awk -F'### ' '/^###/ { print $2 }' "$0"
@kardolus
kardolus / SigningToken.go
Created June 16, 2020 19:22 — forked from mmailhos/SigningToken.go
Exemple of signign an AWS Access Token - Unfixed
package main
import (
"crypto/rsa"
"encoding/base64"
"encoding/binary"
"encoding/json"
"fmt"
"github.com/dgrijalva/jwt-go"
"io/ioutil"
@kardolus
kardolus / anagrams1.go
Last active June 14, 2020 16:10
Find all anagrams in a string
// Use the sliding window method
func findAnagrams(full string, anagram string) []int {
var (
result []int
sample = []rune(full)
gram = make(map[rune]int)
mirror = make(map[rune]int)
)
for _, character := range anagram {
@kardolus
kardolus / reflection.go
Last active November 30, 2019 18:32
playing with reflection and interfaces
package main
import (
"fmt"
"reflect"
)
type Animal interface {
Move()
}