Skip to content

Instantly share code, notes, and snippets.

View zergon321's full-sized avatar
🎮
Fan of Touhou Project

RedBull zergon321

🎮
Fan of Touhou Project
View GitHub Profile
@zergon321
zergon321 / main.go
Last active July 12, 2022 09:19
The A* (astar, a-star) pathfinding algorithm
package main
import (
"fmt"
"strconv"
"strings"
qu "github.com/x1m3/priorityQueue"
)
@zergon321
zergon321 / main.go
Created July 11, 2022 18:06
Dijkstra's algorithm in Go
package main
import (
"fmt"
"github.com/zergon321/arrayqueue"
)
type Node struct {
Cost int
@zergon321
zergon321 / type-cast.go
Created April 29, 2022 21:57
Struct to byte slice in Golang
package main
import (
"fmt"
"unsafe"
)
type Movement struct {
Opcode int
X float64
@zergon321
zergon321 / heapsort.go
Created July 19, 2021 08:40
Heap sort in Go
package main
import (
"fmt"
)
func swap(a, b *int) {
t := *a
*a = *b
*b = t
@zergon321
zergon321 / download.py
Created May 26, 2021 16:38
Download YouTube playlist videos as MP3 files
import pytube, sys, os
if __name__ == "__main__":
playlistURL = sys.argv[1]
playlist = pytube.Playlist(playlistURL)
for video in playlist.videos:
video.streams.get_audio_only().\
download(output_path="./out", filename=video._title)
@zergon321
zergon321 / resolution.go
Created February 26, 2021 23:39
Change the display resolution in Golang on Linux
package main
// #cgo LDFLAGS: -lX11 -lXrandr -lstdc++
// #include <X11/Xlib.h>
// #include <X11/extensions/Xrandr.h>
import "C"
import (
"fmt"
"unsafe"
)
@zergon321
zergon321 / main.go
Created February 26, 2021 20:28
Change the display resolution in Golang on Windows
package main
import (
"fmt"
"os"
"syscall"
"unsafe"
)
const (