Skip to content

Instantly share code, notes, and snippets.

@White2001Offl
White2001Offl / Whatthecommit
Created September 15, 2021 07:19 — forked from seungwon0/Whatthecommit
Random commit message generator
#! /bin/sh
#
# whatthecommit - Random commit message generator
#
# Show random commit message from http://whatthecommit.com/.
#
# Seungwon Jeong <seungwon0@gmail.com>
#
# Copyright 2011 by Seungwon Jeong
@White2001Offl
White2001Offl / hwid.go
Last active August 8, 2021 09:02
Generate Hardware ID in golang
// go get github.com/jaypipes/ghw
// go get github.com/pkg/errors
package main
import (
"github.com/jaypipes/ghw"
"github.com/pkg/errors"
"crypto/md5"
"encoding/hex"
@White2001Offl
White2001Offl / format.go
Created July 29, 2021 08:12
Convert a large floating number to currency readable string
/*
This is about format a large floating number to a readable currency string
Ex - 1684748483.3454
Output - 1,684,748,483.34
You can customize the decimals part to your needs.
*/
func FormatString(number float64) string{
data := fmt.Sprintf("%.2f",number)
temp := strings.Split(data,".")
@White2001Offl
White2001Offl / go.mod
Last active July 13, 2021 10:02
Its a small gist helps to know which apps using microphone ( which are in active state)
module microphone
go 1.14
require (
github.com/go-ole/go-ole v1.2.4
github.com/moutend/go-wca v0.2.0
)
@White2001Offl
White2001Offl / proxypool.go
Created June 6, 2021 05:13
ProxyPool in go with thread safe
/*Its a simple implementation where follows round robin format to access proxies in thread or normal method*/
/*The proxies should be loaded in format ip:port:user:pass*/
import (
"sync"
"fmt"
"os"
"bufio"
"strings"
)
@White2001Offl
White2001Offl / readfile.go
Created June 2, 2021 06:48
ReadFile By lines and append to a slice
import (
"os"
"bufio"
)
func readFileByLine(filename string) (error,[]string){
data := []string{}
file, err := os.Open(filename)
if err != nil{
return err,[]string{}
@White2001Offl
White2001Offl / non_graceful_shutdown.py
Created April 4, 2021 04:23 — forked from clchiou/non_graceful_shutdown.py
Python ThreadPoolExecutor (non-)graceful shutdown
#!/usr/bin/env python3
import concurrent.futures.thread
import sys
import time
from concurrent.futures import ThreadPoolExecutor, as_completed
def remove_file(path):
print('Removing file %s' % path)