Skip to content

Instantly share code, notes, and snippets.

View GabrielModog's full-sized avatar
🤠

Gabriel Tavares GabrielModog

🤠
View GitHub Profile
@GabrielModog
GabrielModog / get-gpu-devices-windows.go
Created August 21, 2024 17:55
get-gpu-devices-windows-with-go
package main
import (
"fmt"
"log"
"os/exec"
"strings"
"syscall"
)
@GabrielModog
GabrielModog / defer.go
Last active August 14, 2024 13:32
defer golang stuff fifo
package main
import (
"fmt"
"os"
)
func f() (ret int) {
defer func() { ret = 10 }()
return ret
@GabrielModog
GabrielModog / checkboard-pattern-rotate.lua
Created August 1, 2024 14:59
checkboard pattern rotate animation with love2d
shader_string = [[
extern number scale;
extern number speed;
extern number timer;
extern number angle;
extern vec2 resolution;
extern vec4 color1;
extern vec4 color2;
vec4 effect(vec4 color, Image text, vec2 texture_coords, vec2 screen_coords)
@GabrielModog
GabrielModog / semigroup.ts
Created August 1, 2024 04:41
Semi Group with Typescript
type SemiGroup<T> = {
append: (a: T, b: T) => T
}
class IntAdd implements SemiGroup<number> {
append(a: number, b: number) {
return a + b
}
}
package main
import (
"fmt"
"time"
)
func collatz(seed int32) int32 {
var steps int32 = 0
for seed > 1 {
const table = ["0x20", "0x21", "0x2c", "0x48", "0x57", "0x64", "0x65", "0x6c", "0x6f", "0x72"]
let idx = [3,6,7,7,8,2,0,4,8,9,7,5,1]
let mount = []
for(let i = 0;i < idx.length;++i) {
const char = String.fromCharCode(parseInt(table[idx[i]], 16))
mount.push(char)
}
package main
import (
"fmt"
"sync"
"time"
)
func main() {
start := time.Now()
package main
import (
"fmt"
)
func main() {
c := "早上好, I'm The Most Human Person In THis PLanet!!11 😧"
for _, rune := range c {
function toPretty(seconds) {
const f = {
"week": 60*60*7*24,
"day": 60*60*24,
"hour": 60*60,
"minute": 60,
"second": 1,
}
if(seconds <= 0) return 'just now'
function sectSort(arr, start, length) {
const sorting = (a, b) => a - b
const begin = arr.slice(0, start)
let slice = arr.slice(start)
if(length && length >= 0) {
slice = slice.slice(0, length)
}