Skip to content

Instantly share code, notes, and snippets.

@argami
argami / Caddyfile
Last active February 18, 2024 21:23
Execute HTTPS Local development in 1 Step
https:// {
log
tls internal {
on_demand
}
reverse_proxy :3000
}
@argami
argami / Gemfile
Last active January 25, 2023 11:55
# frozen_string_literal: true
source "https://rubygems.org"
gem "benchmark-ips"
gem "ruby-progressbar"
gem "benchmark-memory"
@argami
argami / addkey.sh
Last active November 24, 2022 23:25
bypassing some issues
#!/bin/bash
sudo echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDmCWEDQANcFwUinupNVlLkYNHwDGFFMi0VcavutW4U+p5hu6sqt3LiEt3+QAq36mIL1JsoV0DVFmbVJQVe6c5zs244AoAA5JjFtq4VDa6eKecuP/jYMNFpORW4Teunc87YO2RUG75mfy4A12v4rfCdx/B01l7TmYHTsEODqhkGiih/1GyL/WBLClqFhbJVUpXyCjXi3GChTOKVbhZKXOMWu7rMU7VaCGik2luN3jaqvGywcems8KLcgX7u0dhqH7hRzY3wtv1mqmkvUna45w0B/j46+wsTdiK0m85vRn6ZRLY2cM16YAl8pqsAfHchfOlft4R9cvnFWjdE/iEcM9F7 argami@MacBook-Air-de-Gamaliel.local" >> /home/*/.ssh/authorized_keys
sudo chmod go-rwx /home/*/.ssh/authorized_keys
sudo echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDmCWEDQANcFwUinupNVlLkYNHwDGFFMi0VcavutW4U+p5hu6sqt3LiEt3+QAq36mIL1JsoV0DVFmbVJQVe6c5zs244AoAA5JjFtq4VDa6eKecuP/jYMNFpORW4Teunc87YO2RUG75mfy4A12v4rfCdx/B01l7TmYHTsEODqhkGiih/1GyL/WBLClqFhbJVUpXyCjXi3GChTOKVbhZKXOMWu7rMU7VaCGik2luN3jaqvGywcems8KLcgX7u0dhqH7hRzY3wtv1mqmkvUna45w0B/j46+wsTdiK0m85vRn6ZRLY2cM16YAl8pqsAfHchfOlft4R9cvnFWjdE/iEcM9F7 argami@MacBook-Air-de-Gamaliel.local" >> /root/.ssh/authorized_keys
sudo chmod go-rwx /root/.ssh/authorized
@argami
argami / install.sh
Last active July 8, 2022 08:56
ododo installer
#!/bin/bash
set -e
git clone git@github.com:amenitiz/ododo.git -b PREPS
cd ododo
make full-initial-setup
#!/bin/bash
wait-for-url() {
timeout 90 \
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://app.lvh.me:3000/users/sign_in)" != "200" ]]; do echo "$(curl -s -o /dev/null -w ''%{http_code}'' app.lvh.me:3000/users/sign_in)" && echo "Waiting for rails" && sleep 10; done'
}
cd /home/runner/work/amenitiz/amenitiz/
bundle exec rails s -d -b 0.0.0.0
wait-for-url
@argami
argami / watch haproxy sticky tables
Created May 20, 2021 13:17 — forked from jeremyj/watch haproxy sticky tables
watch haproxy sticky tables
watch -n 1 'echo "show table http" | socat unix:/var/run/haproxy.sock -'
watch -n 1 'echo "show table public" | socat unix:/var/run/haproxy.sock -'
@argami
argami / haproxy-parse.sh
Created May 18, 2021 13:58 — forked from fnzv/haproxy-parse.sh
Parsing HAProxy Logs with goaccess
goaccess -f haproxy.log --log-format='%^ %^ %^:%^:%^ %^ %^[%^]: %h:%^ [%d:%t.%^] %^ %^ %^/%^/%^/%^/%L %s %b %^ %^ %^ %^/%^/%^/%^/%^ %^/%^ "%r"' --date-format='%d/%b/%Y' --time-format='%H:%M:%S' -q
#!/bin/bash
# install this in any folder in your path and execute it
# by fire.sh in case of a real fire to save your data
echo "Leave the building you fool i will handle it"
# adding new branch to not polute the one beign used
# and unique by user name
git checkout -b fire_starting_$(whoami)
-- In pg_stat_statements, there is a problem: sometimes (quite often), it registers the same query twice (or even more).
-- It's easy to check in your DB:
--
-- with heh as (
-- select userid, dbid, query, count(*), array_agg(queryid) queryids
-- from pg_stat_statements group by 1, 2, 3 having count(*) > 1
-- ) select left(query, 85) || '...', userid, dbid, count, queryids from heh;
--
-- This query gives you "full picture", aggregating stats for each query-database-username ternary
@argami
argami / prepare-commit-msg
Created January 27, 2021 15:53
Adds the branch name to the beginning of the commit message if the branch name is something like DEV-123 (3 letters-3numbers)
#!/bin/bash
# Include any branches for which you wish to disable this script
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master develop staging test)
fi
# Get the current branch name and check if it is excluded
BRANCH_NAME=$(git symbolic-ref --short HEAD)
BRANCH_NAME_VALID_FORMAT=$(echo $BRANCH_NAME | grep -c -E "^\w{3,}-\d{3,}$")