Skip to content

Instantly share code, notes, and snippets.

View HamzaRahmani's full-sized avatar
🎯
Focusing

Hamza Rahmani HamzaRahmani

🎯
Focusing
  • 03:44 (UTC -05:00)
View GitHub Profile
@HamzaRahmani
HamzaRahmani / message-troll-discord.js
Created January 24, 2024 23:44 — forked from Hacksore/message-troll-discord.js
message-troll-discord.js
const ws = new WebSocket("wss://gateway.discord.gg/?encoding=json&v=9")
const token = ""
const myUsername = ""
const channelId = ""
const messageId = ""
const randomMessages = [
"Pranks are the spice of life, just be sure it's not too spicy!",
"Life's a stage, and pranks are the improv.",
"Pranking: the art of surprise with a side of laughter.",
@HamzaRahmani
HamzaRahmani / settings.json
Created December 11, 2023 01:06
vscode - user settings
{
"security.workspace.trust.untrustedFiles": "open",
"git.enableSmartCommit": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.bracketPairColorization.enabled": true,
"editor.guides.bracketPairs": "active",
"editor.fontLigatures": true,
"editor.tabSize": 2,
"editor.suggest.snippetsPreventQuickSuggestion": true,
@HamzaRahmani
HamzaRahmani / helper.go
Last active December 11, 2023 01:07
Go - FreeTCPPort
// GetFreeTCPPort asks the kernel for a free open port that is ready to use.
func GetFreeTCPPort() (port int, err error) {
var a *net.TCPAddr
if a, err = net.ResolveTCPAddr("tcp", "localhost:0"); err == nil {
var l *net.TCPListener
if l, err = net.ListenTCP("tcp", a); err == nil {
defer l.Close()
return l.Addr().(*net.TCPAddr).Port, nil
}
}