Skip to content

Instantly share code, notes, and snippets.

View mencargo's full-sized avatar
🛠️
fixing it

Diego Algara mencargo

🛠️
fixing it
View GitHub Profile
@mencargo
mencargo / postgresql.md
Last active November 1, 2024 11:43
PostgreSQL Queries

Useful PostgreSQL Queries & Commands

All sizes in MB, change /1024/1024 to /1024/1024/1024 for GB.

Databases sizes

Without system databases

select
datname as database,
(pg_database_size(datname)/1024/1024) as size
@mencargo
mencargo / linux.md
Last active September 12, 2024 16:56
Linux commands

Some useful Linux commands

Disk usage

df -h

Folder size

du -sh folder

Files created last week / past 12 hrs

@mencargo
mencargo / dnsmasq.md
Last active August 20, 2021 16:36
Simple DNSmasq filter

DNSmasq for local DNS service:

Config file usualy in /etc/dnsmasq.conf

no-resolv
user=root
server=8.8.8.8
server=1.1.1.1
server=9.9.9.9
cache-size=6400
@mencargo
mencargo / cyberpanel.md
Last active April 29, 2024 11:52
CyberPanel cheatsheet

Cleanup

clear all logs of CP

rm -rf /usr/local/lsws/logs/*

clear OpenLiteSpeed cache folder

rm -rf /usr/local/lsws/cachedata

remove old CyberPanel versions

@mencargo
mencargo / cpanel.md
Created March 9, 2023 17:03
cPanel stuff

cPanel

mkdir -p /root/cpanel_profile && echo "mysql-version=10.3" > /root/cpanel_profile/cpanel.config
cd /home && curl -o latest -L https://securedownloads.cpanel.net/latest && sh latest

Delete garbage files

@mencargo
mencargo / git.md
Last active March 19, 2024 21:43
GIT stuff

BASH (~/.bashrc)

# Simple git prompt
COLOR_GIT_CLEAN='\[\033[1;30m\]'
COLOR_GIT_MODIFIED='\[\033[0;33m\]'
COLOR_GIT_STAGED='\[\033[0;36m\]'
COLOR_RESET='\[\033[0m\]'

function git_prompt() {
@mencargo
mencargo / wsl.md
Created September 26, 2024 01:10
WSL useful commands

List available official WSL distros:

> wsl --update
> wsl --list --online

Update locale inside debian:

$ sudo update-locale LANG=en_US.UTF8