Skip to content

Instantly share code, notes, and snippets.

View salehi's full-sized avatar

SS Salehi salehi

View GitHub Profile
@salehi
salehi / gitlab-reset-password.md
Created December 29, 2025 10:26
Gitlab Console reset password

Get in the rails console

sudo gitlab-rails console -e production

then:

user = User.find_by_username('root')
user.password = 'new_password_here'
user.password_confirmation = 'new_password_here'

Pacman Quick Reference for apt Users

apt pacman what it does
apt update pacman -Sy sync package database
apt upgrade pacman -Su upgrade installed packages
apt update && apt upgrade pacman -Syu sync + upgrade (use this one)
apt install pkg pacman -S pkg install package
apt remove pkg pacman -R pkg remove package
apt purge pkg pacman -Rns pkg remove pkg + deps + configs

K3s Disk Cleanup

Quick Commands

Images

# List images
k3s crictl images

# Remove unused images

Fix Windows 11 NTFS Read-Only Mount in Linux

Problem

Windows disk mounts as read-only in Linux due to Windows Fast Startup leaving the filesystem in a hibernated state.

Solution: Disable Windows Fast Startup

Method 1: Control Panel (Recommended)

  1. Open Control Panel
@salehi
salehi / mssqlbackup
Created December 6, 2023 12:19 — forked from allebb/mssqlbackup
Shell script to backup Microsoft SQL Server vNEXT databases on Linux.
#!/usr/bin/env bash
#
# Shell script to automate the backup of Microsoft SQL Server vNEXT backups on Linux.
# Written by Bobby Allen <[email protected]>, 26/04/2017
#
# Download this script and put into your servers' /usr/bin directory (or symlink) then make it executable (chmod +x)
#
# Usage example (backup databases into /var/backups, keep backups for 5 days, connect to server "localhost" with the account "sa" and a password of "P455w0RD"):
# mssqlbackup "/var/dbbackups" 5 "localhost" "sa" "P455w0rD"
@salehi
salehi / mysql-performance-tuning.sql
Created November 25, 2023 19:24 — forked from denji/mysql-performance-tuning.sql
MySQL Performance Tuning
-- Query the database to calculate a recommended innodb_buffer_pool_size
-- and get the currently configured value
-- The rollup as the bottom row gives the total for all DBs on the server, where each other row is recommendations per DB.
SELECT
TABLE_SCHEMA,
CONCAT(CEILING(RIBPS/POWER(1024,pw)),SUBSTR(' KMGT',pw+1,1))
Recommended_InnoDB_Buffer_Pool_Size,
(
SELECT CONCAT(CEILING(variable_value/POWER(1024,FLOOR(LOG(variable_value)/LOG(1024)))),SUBSTR(' KMGT',FLOOR(LOG(variable_value)/LOG(1024))+1,1))
@salehi
salehi / bench.py
Created July 20, 2023 08:41 — forked from methane/bench.py
Benchmarking MySQL drivers (Python 3.4)
from __future__ import print_function
import time
def query_10k(cur):
t = time.time()
for _ in range(10000):
cur.execute("SELECT 1,2,3,4,5")
res = cur.fetchall()
assert len(res) == 1
assert res[0] == (1,2,3,4,5)
@salehi
salehi / config.json
Created August 17, 2022 13:36 — forked from iandol/config.json
V2Ray setup, adds HTTP and SOCKS proxy and more logging (see https://www.v2ray.com/en/configuration/index.html). Another option is to use clash to provide a HTTP to SOCKS proxy https://github.com/Dreamacro/clash
{
"log": {
"logelevel": "info"
},
// Run a local SOCKS proxy for apps to connect to.
"inbounds": [{
"port": 1080,
"listen": "127.0.0.1",
"protocol": "socks",
"sniffing": {
from time import sleep
import requests
import json
def vote():
req = requests.post('https://www.menti.com/core/identifiers',
headers={'authority': 'www.menti.com',
'content-length': '0',