Skip to content

Instantly share code, notes, and snippets.

View jpcaparas's full-sized avatar
🐔

Jayps jpcaparas

🐔
View GitHub Profile
@jpcaparas
jpcaparas / launchd.org
Created July 7, 2024 12:10 — forked from dabrahams/launchd.org
Notes on Apple's under-documented launchd

Notes on Apple’s Under-Documented LaunchD

Start triggers fire regardless of other conditions

For example, StartOnMount=true will cause the job to start when anything is mounted even if other conditions, e.g. QueueDirectories, say the job should not run

Rhythm of repeating jobs

The StartInterval timer begins ticking at the moment the plist is loaded. If something like QueueDirectories is preventing the job from

@jpcaparas
jpcaparas / script.py
Created March 9, 2024 10:37
Python 5 concurrent SOCKS5 requests
import argparse
import requests
import threading
from concurrent.futures import ThreadPoolExecutor, as_completed
from itertools import cycle
def make_request(server, socks5_credentials, semaphore):
username, password, port = socks5_credentials.split(':')
proxies = {
@jpcaparas
jpcaparas / inode-count-count-basic.sh
Last active March 8, 2024 12:25
Find sub-directories with highest inode count
#!/bin/bash
find . -maxdepth 1 -mindepth 1 -type d -exec sh -c 'echo -n "{}: " ; find "{}" | wc -l' \;
@jpcaparas
jpcaparas / cmd.md
Last active February 7, 2024 09:30
Do not use file cache on Laravel's artisan:serve command

Step 1: Terminate the running web server

Step 2: Modify the .env directive CACHE_DRIVER to be array instead of file.

Step 3: Remove the cached bootstrap files by running php artisan optimize:clear

Step 4: Flush the application cache for good measure by running php artisan optimize:clear

Step 5: Run php artisan serve. Any real-time changes to your .env file should reflect immediately on the app rather than having to force a web server restart each time.

@jpcaparas
jpcaparas / cmd.sh
Last active February 7, 2024 09:11
Quickly spin up a MySQL container that's bind-mounted to a host volume and include an accompanying PHPMyAdmin UI
#!/bin/bash
# Some args are OrbStack-specific
# To enter the instance, run:
# docker exec -it kiwinoy_mysql8 mysql -u root -p
docker run \
-d \
--rm \
@jpcaparas
jpcaparas / workstation.yaml
Created October 22, 2023 22:52
Ansible workstation (AMD64 & ARM64)
---
- name: Install multiple packages on localhost for arm64 and amd64 architectures
hosts: localhost
gather_facts: true
connection: local
become: true
become_method: sudo
tasks:
- name: Update package list
apt:
@jpcaparas
jpcaparas / delete_git_submodule.md
Created September 27, 2023 10:09 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@jpcaparas
jpcaparas / commands.txt
Created September 1, 2023 01:29
macOS: Make Spotlight focus on application on a different Space
# Disable indexing
sudo mdutil -a -i off
# Re-enable indexing
sudo mdutil -a -i on
@jpcaparas
jpcaparas / command.sh
Created May 28, 2023 08:39
Running video2x as a container to convert a video to 4K
# Change arguments as needed
docker run --rm -it --name video2x_container -v $PWD/video2x:/tmp ghcr.io/k4yt3x/video2x:5.0.0-beta6 -i /tmp/to_upscale.mp4 -o /tmp/upscaled.mp4 -l=debug upscale -h=2160 -w=3840
@jpcaparas
jpcaparas / podman_macos.md
Created March 27, 2023 00:09 — forked from kaaquist/podman_macos.md
Podman with docker-compose on MacOS.

Podman with docker-compose on MacOS.

Podman an alternative to Docker Desktop on MacOS

Getting podman installed and started is super easy.
Just use brew to install it.

> brew install podman

Now since podman uses a VM just like the Docker Client on MacOS we need to initialize that and start it.