Skip to content

Instantly share code, notes, and snippets.

View arbal's full-sized avatar
👌
new Adaptor(this); // new Adaptor(_humans[].Behavior);

Arbal arbal

👌
new Adaptor(this); // new Adaptor(_humans[].Behavior);
  • Los Angeles, CA
  • 09:27 (UTC -07:00)
View GitHub Profile
@arbal
arbal / slash.sh
Created June 23, 2024 19:34 — forked from luciomartinez/slash.sh
Add or Remove trailing slash in bash
### Add trailing slash if needed
STR="/i/am/a/path"
length=${#STR}
last_char=${STR:length-1:1}
[[ $last_char != "/" ]] && STR="$STR/"; :
echo "$STR" # => /i/am/a/path/
@arbal
arbal / README.md
Created June 19, 2024 23:30 — forked from disler/README.md
Use these Prompt Chains to build HIGH QUALITY AI Agents (Agentic Building Blocks)

Setup

  1. Create a new directory with these three files (requirements.txt, main.py, README.md)
  2. python -m venv venv
  3. source venv/bin/activate
  4. pip install -r requirements.txt
  5. python main.py
  6. Update main() to run the example prompt chains
#!/usr/bin/env bash
echo 'net.ipv4.ip_forward = 1' | sudo tee /etc/sysctl.d/20-tailscale.conf
echo 'net.ipv6.conf.all.forwarding = 1' | sudo tee -a /etc/sysctl.d/20-tailscale.conf
sudo sysctl -p /etc/sysctl.d/20-tailscale.conf
printf '#!/bin/sh\n\nethtool -K %s rx-udp-gro-forwarding on rx-gro-list off \n' "$(ip route show 0/0 | cut -f5 -d" ")" | sudo tee /etc/networkd-dispatcher/routable.d/50-tailscale
sudo chmod 755 /etc/networkd-dispatcher/routable.d/50-tailscale
sudo /etc/networkd-dispatcher/routable.d/50-tailscale
@arbal
arbal / docker-swarm-architecture.md
Created May 21, 2024 02:31 — forked from scyto/docker-swarm-architecture.md
My Docker Swarm Architecture
@arbal
arbal / ubuntu_22.04_motd.md
Created April 13, 2024 00:18 — forked from jfeilbach/ubuntu_22.04_motd.md
Make Ubuntu 22.04 less annoying. Remove ESM Ubuntu Advantage

Ubuntu 22.04 Annoyances

Here are a few collected ways I like to customize Ubuntu 22.04 servers. I used to love Ubuntu, but I hate auto updates and snaps. They also put ads and other usless ads diguised as "news" in MOTD. ESM FUD is spread throughout the OS including simple apt functions. You do not need ESM and thus Ubuntu 22.04 has become super annoying. unattended-upgrade is an automatic installation of security (and other) upgrades without user intervention. Consider the ramifications of disabling this service.

Disable unattended upgrades

The Unattended Upgrades feature is enabled by default and it runs at system boot without the user's permission. The configuration is stored in /etc/apt/apt.conf.d/20auto-upgrades

Disable: sudo dpkg-reconfigure unattended-upgrades then a TUI will come up, select "No"

This will not permantently disable the function. After an update it will be enabled. In the file /etc/apt/apt.conf.d/20auto-upgrades change these values from 1 to 0. Even doing this it will

@arbal
arbal / llmc.sh
Created March 31, 2024 18:59 — forked from montasaurus/llmc.sh
AI Shell Command Generator
llmc() {
local system_prompt='Output a command that I can run in a ZSH terminal on macOS to accomplish the following task. Try to make the command self-documenting, using the long version of flags where possible. Output the command first enclosed in a "```zsh" codeblock followed by a concise explanation of how it accomplishes it.'
local temp_file=$(mktemp)
local capturing=true
local command_buffer=""
local first_line=true
local cleaned_up=false # Flag to indicate whether cleanup has been run
cleanup() {
# Only run cleanup if it hasn't been done yet
@arbal
arbal / fix_github_copilot.sh
Created March 21, 2024 17:23 — forked from sarimarton/fix_github_copilot.sh
Fix Github Copilot in dealing with self-signed certificates
# [2023-05-25] Added Copilot Chat, and VSCode Insiders
# [2023-05-20] Add VSCode Insiders variant
# [2023-02-22] Added Copilot Labs
# Fix Github Co-pilot self-signed cert problem
# See: https://github.com/orgs/community/discussions/8866#discussioncomment-3517831
# Note
#
# To make Github Copilot/Nightly/Labs/Chat work, you might need additional
@arbal
arbal / lvextend
Created March 9, 2024 19:06 — forked from stefan2904/lvextend
how to extend your /home logical volume with LVM on ext4
% df -h
Filesystem Size Used Avail Use% Mounted on
/dev/dm-1 46G 14G 31G 31% /
udev 10M 0 10M 0% /dev
tmpfs 2.3G 9.2M 2.3G 1% /run
tmpfs 5.8G 232K 5.8G 1% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 5.8G 0 5.8G 0% /sys/fs/cgroup
/dev/mapper/thinkbook-home 92G 55G 33G 63% /home
/dev/sda1 232M 35M 181M 16% /boot
@arbal
arbal / newsyslog-for-your-project.conf
Created March 1, 2024 22:14 — forked from johncarney/newsyslog-for-your-project.conf
Example newsyslog configuration for rotating Rails log files on Mac OS X.
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
/Users/your-username/path-your-rails-project/log/*.log your-username:staff 644 4 * $D0 GJ
# NOTES
#
# Place file in /etc/newsyslog.d
# '$D0' under 'when' tells newsyslog to rotate logs daily at midnight.
# Alternatively you could use '24' for 'when', which would specify "every 24 hours"
# '*' under 'size' specifies that logs should be rotated regardless of their size.
# 'G' under 'flags' tells newsyslog that the 'logfilename' is a pattern and it should rotate all log files matching the pattern.
#!/usr/bin/env bash
size=1024 # MB
mount_point=$HOME/tmp
name=$(basename "$mount_point")
usage() {
echo "usage: $(basename "$0") [mount | umount | remount | check | orphan]" \
"(default: mount)" >&2
}