Skip to content

Instantly share code, notes, and snippets.

View Subi's full-sized avatar
🏹
excelsior

Justin Subi

🏹
excelsior
View GitHub Profile
@Subi
Subi / formatter.go
Last active December 24, 2021 02:22
Read content from .txt file and output the results to be used with .yaml files
package formatter
import (
"fmt"
"io/ioutil"
"log"
"strings"
)
type Formatter interface {
@Subi
Subi / proxy.js
Created June 27, 2020 19:45
Read a list of proxies from text file and format them for JSON
const fs = require('fs');
const proxies = fs.readFileSync('proxies.txt', 'utf-8');
let splitProxies = proxies.split('\n');
let output = splitProxies.map((proxy, index) => {
sanatizeProxy = proxy.replace('\r', '');
if (splitProxies[index + 1] != undefined) {
return `"${sanatizeProxy}",`;
}
@Subi
Subi / Nonce.go
Last active April 4, 2020 23:18
Generate a random size string nonce.
func genNonce(length int) string {
const charset = "abcdefghijklmnopqrstuvwxyz" +
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
nonce := ""
for i := 0; i < length; i++ {
rand.Seed(time.Now().UnixNano())
nonce += strings.Split(charset, "")[rand.Intn(len(strings.Split(charset, "")))]
}
return strings.ToUpper(nonce)
}