Skip to content

Instantly share code, notes, and snippets.

@meyt
meyt / 01_cs2run.sh
Last active April 24, 2024 14:35
cs2 setup
#!/bin/bash
SRCDS_TOKEN="..."
CS2_RCON_PORT=1002
CS2_PORT=27015
CS2_RCONPW="changeme"
CS2_PW="changeme"
CS2_MAXPLAYERS=10
CS2_ADDITIONAL_ARGS=""
CS2_GAMEALIAS="competitive" # competitive, wingman, casual, deathmatch, custom
CS2_MAPGROUP="mg_active"
@meyt
meyt / output.json
Last active April 23, 2024 21:25
Scrape CS2 commands documentation
[
[
"_record",
"cmd",
[
"norecord",
"release"
],
"Record a demo incrementally.\n"
],
@meyt
meyt / server.py
Created March 30, 2024 17:52 — forked from mdonkers/server.py
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
License: MIT License
Copyright (c) 2023 Miel Donkers
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
@meyt
meyt / killover.sh
Created March 19, 2024 06:08
kill recent process of specific user
#!/bin/bash
# Usage: killover.sh nginx john 3
# Which means john can have maximum 3 nginx processes, the newest ones must be killed.
cmd=$1
user=$2
max_pids=$3
pids="$(ps --sort=start_time --user "$user" --format pid,cmd | grep "$cmd" | awk '{print $1}')"
pids_count=$(echo "$pids" | wc -l)
@meyt
meyt / conn-uptime.sh
Created March 15, 2024 00:46
Get nmcli connection uptime
#!/bin/bash
# Usage: ./conn-uptime.sh MyConnectionName
conn=$1
timestamp1=$(nmcli -f connection.timestamp conn show $conn | awk '{print $2}')
current_time=$(date +%s)
duration=$((current_time - timestamp1))
echo "Duration since last network connection: $duration seconds"
@meyt
meyt / .bashrc
Created October 1, 2023 04:03
.bashrc
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# paths
export PATH=$HOME/bin:/usr/local/bin:$PATH
export PATH=$PATH:$HOME/.node/bin
export PATH=$PATH:$HOME/.local/bin
@meyt
meyt / csgo-setup.sh
Last active July 7, 2023 19:38
Setup CSGO server on linux/ubuntu
#!/bin/bash
##
# Setup CSGO Server
#
# os: ubuntu 20.04
##
HOSTNAME="csgo.meyti.ir"
ADMINPASS="adminpass"
@meyt
meyt / acc2sql.sh
Last active May 6, 2023 09:08
Export MS Access database (accdb, accde) in linux+mdbtools
#!/bin/bash
# tested with mdbtools@0.9.1-1 on Debian@11
#
# Setup:
# sudo apt install mdbtools -y
#
# Usage:
# bash ./acc2sql.sh mydb.accdb mydb.sql
##
@meyt
meyt / httpbench.py
Last active April 13, 2023 00:09
Measure HTTP request and response time in Python
import socks
from time import time
from dataclasses import dataclass
from http.client import HTTPConnection, HTTPSConnection, HTTPResponse
from urllib.parse import urlparse
USER_AGENT = (
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) "
@meyt
meyt / csgo-sourcemod.sh
Last active December 13, 2022 13:23
Install CSGO Sourcemod on Linux
#!/bin/bash
# sourcemod is based on metamod
tempdir="/opt/csgo-addons"
csgodir="/home/steam/csgo-server/csgo"
mkdir $tempdir
cd $tempdir