- Create a new directory with these three files (requirements.txt, main.py, README.md)
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python main.py
- Update
main()
to run the example prompt chains
### 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/ |
#!/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 |
This (and related gists) captures how i created my docker swarm architecture. This is intended mostly for my own notes incase i need to re-creeate anything later! As such expect some typos and possibly even an error...
Each major task has its own gist, this is to help with maitainability long term.
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.
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
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 |
# [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 |
% 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 |
# 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 | |
} |