Skip to content

Instantly share code, notes, and snippets.

@ajeebkp23
ajeebkp23 / gist:dd9a0acd4dc427a28d9661e6c0b743d7
Created July 7, 2024 08:17
Install gnome boxes and virt-manager
sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils
sudo apt install gnome-boxes
sudo apt install virt-manager
@ajeebkp23
ajeebkp23 / gist:8d2ad433188972666c7a8e467b7cc6a1
Last active July 7, 2024 08:28
asdf php build dependencies
# Tested from Peppermint OS (Debian 12)
sudo apt install libcurl4-openssl-dev libgd-dev libonig-dev libzip-dev build-essential autoconf libtool bison re2c pkg-config libxml2-dev libssl-dev libsqlite3-dev libpq-dev libreadline-dev
du -h --max-depth=1 | grep '[0-9]G\>'
@ajeebkp23
ajeebkp23 / gist:944a5a5aba78a7a9298a66d9ed05fbda
Created June 7, 2024 08:44
Install tesseract in Ubuntu / Debian a.k.a Debian family
sudo apt install tesseract-ocr
sudo apt install libtesseract-dev
@ajeebkp23
ajeebkp23 / compare-sha-256-with-file.bash
Last active June 7, 2024 08:34
Compare sha 256 with file
# https://security.stackexchange.com/a/219325
sha256() {
echo "$1 $2" | sha256sum --check
}
# sha256 <expected-sha-256-sum> <name-of-the-file>
@ajeebkp23
ajeebkp23 / gist:b63999b595075528fc118e147f37e848
Last active January 21, 2024 14:09
Nginx config sample for Django
server {
server_name example.com;
root /home/myuser/mydjangoproject/staticfiles/;
index index.html;
proxy_headers_hash_max_size 512;
proxy_headers_hash_bucket_size 128;
# Proxy connections to the application servers
# app_servers
@ajeebkp23
ajeebkp23 / gist:0818e0bd5c375270570f2b2a0cebe069
Created January 20, 2024 22:59
Install Nerd Font FiraCode on Debian based Linux
sudo apt install unp
mkdir /tmp/FiraCode/
pushd /tmp/FiraCode/
# https://github.com/ryanoasis/nerd-fonts/releases/
wget https://github.com/ryanoasis/nerd-fonts/releases/download/v3.1.1/FiraCode.tar.xz
unp FiraCode.tar.xz
popd
mkdir -p ~/.local/share/fonts/
mv /tmp/FiraCode ~/.local/share/fonts/
fc-cache -f -v
@ajeebkp23
ajeebkp23 / boring_birthdays.py
Created December 20, 2023 05:04
Boring Birthdays
#!/usr/bin/env python3
import sys
from datetime import datetime
#print(len(sys.argv))
if len(sys.argv) == 4:
birthday = " ".join(sys.argv[1:4])
elif len(sys.argv) == 3:
birthday = " ".join(sys.argv[1:3]) + " x"
elif len(sys.argv) == 1:
@ajeebkp23
ajeebkp23 / livecd-recovery.bash
Last active July 31, 2020 12:54
LiveCdRecovery for apt install and other fixes
# Boot the Ubuntu Live CD.
# https://help.ubuntu.com/community/LiveCdRecovery
# Press Ctrl-Alt-F1
chr=/mnt/
sudo mount /dev/sda1 $chr
sudo mount --bind /dev $chr/dev
sudo mount --bind /proc $chr/proc
@ajeebkp23
ajeebkp23 / ps-memory.bash
Created May 27, 2020 17:54
Memory used per process
ps -eo size,pid,user,command --sort -size | \
awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' |\
cut -d "" -f2 | cut -d "-" -f1
# Find gunicorn specific
ps -eo size,pid,user,command --sort -size | \
awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' |\
cut -d "" -f2 | cut -d "-" -f1 | grep gunicorn