Skip to content

Instantly share code, notes, and snippets.

View diegopacheco's full-sized avatar

Diego Pacheco diegopacheco

View GitHub Profile
@diegopacheco
diegopacheco / nodejs-npm-list-transitive-deps.md
Created November 17, 2023 04:50
List nodejs transitive dependencies
npm list -depth=10
@diegopacheco
diegopacheco / perf.md
Created November 16, 2023 08:11
Install PERF ubuntu 20
git clone --depth 1 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
cd linux/tools/perf
make
cp perf /usr/bin
sudo apt-get install libpython3.11-dev
perf -v
perf version 6.7.rc1.gc42d9eeef8e5
@diegopacheco
diegopacheco / fix-django-watchman-python-3.11.md
Created November 3, 2023 01:56
Fix Django Watchman in ubuntu - Python 3.11

Problem

django.utils.autoreload.WatchmanUnavailable: watchman command error: A non-recoverable condition has triggered.  Watchman needs your help!

Fix

echo 256 | sudo tee -a /proc/sys/fs/inotify/max_user_instances
echo 32768 | sudo tee -a /proc/sys/fs/inotify/max_queued_events
echo 65536 | sudo tee -a /proc/sys/fs/inotify/max_user_watches
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
@diegopacheco
diegopacheco / certificate.md
Created October 27, 2023 03:19
How to create self-signed certificate
# interactive
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 365
# non-interactive and 10 years expiration
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 3650 -nodes -subj "/C=XX/ST=StateName/L=CityName/O=CompanyName/OU=CompanySectionName/CN=CommonNameOrHostname"
@diegopacheco
diegopacheco / php-8.1-nginx.md
Created September 27, 2023 06:07
Install PHP 8.1 Nginx
#!/bin/bash

sudo apt-get update -y
sudo apt-get install nginx -y
sudo apt-get install php8.1-fpm -y
sudo systemctl status php8.1-fpm

sudo sh -c 'cat ./default > /etc/nginx/sites-available/default'
sudo nginx -t
@diegopacheco
diegopacheco / open-core-ocaml.md
Last active September 26, 2023 07:19
ocaml - Error: Unbound module Core

First we need to add some config to .ocamlinit

vim ~/.ocamlinit

Add this:

#use "topfind"
#thread
#require "core.top"
#require "core"
@diegopacheco
diegopacheco / c-troubleshooting.md
Created September 25, 2023 22:30
C troubleshooting

Check if you have a lib?

sudo ldconfig -p | grep uuid
	libuuid.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libuuid.so.1
	libuuid.so.1 (libc6) => /lib/i386-linux-gnu/libuuid.so.1
	libuuid.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libuuid.so
	libossp-uuid.so.16 (libc6,x86-64) => /lib/x86_64-linux-gnu/libossp-uuid.so.16
	libossp-uuid++.so.16 (libc6,x86-64) => /lib/x86_64-linux-gnu/libossp-uuid++.so.16
@diegopacheco
diegopacheco / brew-disabled-formula-install.md
Created September 22, 2023 20:27
How to install homebrew disable formula?
HOMEBREW_NO_INSTALL_FROM_API=1 brew install python@3.7
@diegopacheco
diegopacheco / ulimit.md
Last active September 19, 2023 00:34
Increase open file descriptors

linux setup

Linux default is 1024, macos default is 256. This is per session, if close or open a new terminal will be lost.

ulimit -a
ulimit -n 65000
sysctl -p
ulimit -a

gatling recomendations

@diegopacheco
diegopacheco / cgroups-mount-unknown.md
Created September 13, 2023 05:18
cgroups: cannot found cgroup mount destination: unknown

Issue

Cannot start service redis-node-2: cgroups: cgroup mountpoint does not exist: unknown

Fix

sudo mkdir /sys/fs/cgroup/systemd
sudo mount -t cgroup -o none,name=systemd cgroup /sys/fs/cgroup/systemd