Skip to content

Instantly share code, notes, and snippets.

View parsibox's full-sized avatar

Mohsen Davari parsibox

View GitHub Profile
@parsibox
parsibox / Screenshot.go
Created November 10, 2023 04:48
golang Screenshot
package main
import (
"context"
"io/ioutil"
"log"
"time"
"github.com/chromedp/chromedp"
)
ulimit
update os
install wget , zip , unzip , tcpdump
os limit
allow soduer
allow no password
swap 16 G
sudo systemctl enable mongodb
show dbs
use admin
db.dropUser("yyyy")
db.createUser({user:"zzzz", pwd:"xxxx", roles:[{role:"root", db:"admin"}]})
mongo -u admin -p admin123 --authenticationDatabase admin
enabled within the security section of your mongod.conf file (like below).
security:
@parsibox
parsibox / bot.js
Last active September 21, 2023 10:18
cloudflare worker call url bot.js
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
/**
* Respond with hello worker text
* @param {Request} request
*/
async function handleRequest(request) {
if (request.method !== 'POST') {
return new Response('Method Not Allowed', { status: 405 })
@parsibox
parsibox / gist:00c13bf8c1afcc165de3b52e644b05ea
Created September 9, 2023 14:38
windows rename file with powershell
Get-ChildItem -Path D:\wamp64\www\product_golang\telirco\product\sms_esb\bin\linux_service\worker_db_queue_bulk\* -Recurse | Where-Object {$_ -match "peertopeer"} | Ren -NewName {$_ -replace "peertopeer","bulk"}
echo "_ZNSt12_Bind_simpleIFPFvSsSsEPcS2_EE9_M_invokeIJLm0ELm1EEEEvSt12_Index_tupleIJXspT_EEE+0xa0" | c++filt
nm -D telircoampq.so
@parsibox
parsibox / updateBash.sh
Created July 9, 2023 07:03
Update output of Bash script
for i in $(seq 1 100); do printf "\r%s%%" "$i"; sleep 0.1; done
for i in {1..100}; do
percent=$(($i))
printf "\r%s%%" "${percent}"
sleep 0.1
done
@parsibox
parsibox / RateLimiter.go
Created July 8, 2023 07:52
rate limitter with go
package main
import (
"context"
"fmt"
"time"
"golang.org/x/time/rate"
)
@parsibox
parsibox / localdns.go
Last active September 9, 2023 06:34
add a local dns for address in windows with golang
package main
import (
"fmt"
"io/ioutil"
"os"
)
func main() {
// Read existing hosts file
@parsibox
parsibox / go-redis.go
Created June 14, 2023 18:20
add 1000000 record in redis with max Concurrency
package main
import (
"context"
"fmt"
"github.com/redis/go-redis/v9"
"sync"
"time"
)