Skip to content

Instantly share code, notes, and snippets.

View strzibny's full-sized avatar
🏠
Working from home

Josef Strzibny strzibny

🏠
Working from home
View GitHub Profile
@andrasbacsai
andrasbacsai / firewall.sh
Last active December 14, 2024 17:38
Update a Hetzner Firewall rule with your IP address
#!/bin/bash
# Script to update a firewall rule in a Hetzner Firewall with your current IP address.
# Good if you would like to restrict SSH access only for your current IP address (secure).
#################
# WARNING: This script will overwrite all rules in the firewall rules, so make sure you
# added all the required rules.
# I use a separate firewall rule just for SSH access.
#################
@MiroslavCsonka
MiroslavCsonka / .env
Created October 4, 2024 23:19
ELK set-up for local Rails development
ELASTIC_PASSWORD=<your-elastic-password>
KIBANA_PASSWORD=<your-kibana-password>
@bakatz
bakatz / import_dotenv_to_gh_and_kamal.sh
Last active August 8, 2024 02:26
Import your .env files to GitHub Actions and generate a Kamal .env.erb referencing all of them
#!/bin/bash
# Check if .env file is provided as argument
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <path-to-.env-file>"
exit 1
fi
ENV_FILE=$1
@tarellel
tarellel / default_key_bindings.json
Created July 8, 2024 19:46
Zed Settings and Extensions
[
// Standard macOS bindings
{
"bindings": {
"up": "menu::SelectPrev",
"pageup": "menu::SelectFirst",
"shift-pageup": "menu::SelectFirst",
"ctrl-p": "menu::SelectPrev",
"down": "menu::SelectNext",
"pagedown": "menu::SelectLast",
#!/usr/bin/env bash
# Abort sign off on any error
set -e
# Start the benchmark timer
SECONDS=0
# Repository introspection
OWNER=$(gh repo view --json owner --jq .owner.login)
@ivan3bx
ivan3bx / generate_previews.rb
Created February 9, 2024 17:33
Ruby script to generate screenshots for a series of URLs crawled from a sitemap.xml
require "selenium-webdriver"
require "nokogiri"
require "net/http"
BASE_URL = "http://localhost:1313"
#
# This expects several things to be true:
#
# 1. Local hugo instance running at localhosts:1313
module SessionSystemTestHelper
def sign_in_as(user)
visit root_url # any fast-to-load page will do
cookie_jar = ActionDispatch::TestRequest.create.cookie_jar
cookie_jar.signed[:session_token] = user.sessions.create.token
page.driver.browser.manage.add_cookie(name: "session_token", value: cookie_jar[:session_token], sameSite: :Lax, httpOnly: true)
end
end
@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
}
@huksley
huksley / mrsk.md
Last active January 12, 2024 17:24
mrsk - the missing manual

MRSK

This documentation adds important additions to the docs for mrsk deploy tool (see github.com/mrsked/mrsk)

Destination flag

You can use mrsk deploy --destination staging

This will read config/deploy.yml and config/deploy.staging.yml files, and also will read .env.staging file if it exists.

@fractaledmind
fractaledmind / application.rb
Last active June 6, 2024 16:41
Create a simple, beautiful Rails-integrated multi-file input that behaves like: https://codepen.io/smargh/pen/mdGLpEz. Uses TailwindCSS, StimulusJS, and ActiveStorage.
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.0
# ensure that `update(files: [uploaded_file])` will append, not replace
config.active_storage.replace_on_assign_to_many = false
end