Skip to content

Instantly share code, notes, and snippets.

View amicojeko's full-sized avatar

Stefano Guglielmetti amicojeko

View GitHub Profile
@amicojeko
amicojeko / procedura_ssh_mac.md
Created November 6, 2025 08:33
Aggiungere chiavi SSH esistenti al nuovo Mac

Aggiungere chiavi SSH esistenti al nuovo Mac

🔧 1. Copia le chiavi sul nuovo Mac

Se le hai su un altro computer:

scp -r user@old-mac:~/.ssh ~/.ssh

Oppure, se le hai su una chiavetta o drive, copiale manualmente nella cartella:

@amicojeko
amicojeko / delete_silent_segments.lua
Created June 3, 2025 21:54
Davinci Resolve Lua script to delete video segments without audio
-- rebuild_from_audio.lua – crea una timeline che contiene solo
-- i segmenti dove l'audio esiste (isole dopo Detect Silence).
-- da usare dopo aver fatto remove silence
--------------------------------------------------
-- CONFIG
local srcVTrack, srcATrack = 1, 1 -- tracce di partenza (dove c'è il materiale)
local dstVTrack, dstATrack = 1, 1 -- tracce destinazione nella nuova timeline
local newTLName = "AutoCut_fromAudio"
@amicojeko
amicojeko / unused_methods.sh
Last active January 10, 2024 18:29
Finds defined and unused methods in a Ruby project
#!/bin/bash
cd /path/to/my/app # Go to the app path
echo "Searching for Ruby method definitions..."
method_names=$(git grep -h -o -E '^ *def +([a-zA-Z_][a-zA-Z0-9_]*)' -- '*.rb' | sed -E 's/^ *def +//' | sort -u)
if [ -z "$method_names" ]; then
echo "No Ruby method found, or no .rb files found."
@amicojeko
amicojeko / contributors_deleted_lines.sh
Last active January 10, 2024 14:29
Git deleted lines report per contributor
#!/bin/bash
# Verify is this is a git repo
if ! git rev-parse --git-dir > /dev/null 2>&1; then
echo "Questo non è un repository Git."
exit 1
fi
IFS=$'\n' # Change the line separator to avoid breaking lines on spaces
@amicojeko
amicojeko / secret_santa.rb
Last active November 15, 2022 14:15
Secret Santa's Helper Bot
# frozen_string_literal: true
# To obtain a google mail's password, you need to:
# 1. Go to gmail
# 2. in the top right corner click on the menu icon and select 'Account'
# 3. Click on 'Sign in & Security'
# 4. Scroll down the 'Security' and find a section called 'Signing in to Google'.
# 5. Click on "App passwords"
# 6. You should see a dropdown labelled 'Select App'. Select Mail.
# 7. For the 'on my device' dropdown select 'Other' and type in commandline or whatever you want to call the app.
@amicojeko
amicojeko / yaml.rake
Last active August 30, 2022 10:23
YAML Sorter
# Code by PZac
require 'yaml_sorter'
namespace :yaml do
task :fix_all do
Dir.glob('config/locales/**/*.yml').each do |f|
YamlSorter.new(f).fix!
end
end

Introduction

Ruby on Rails is the framework of choice for web apps at Shopify. It is an opinionated stack for quick and easy development of apps that need standard persistence with relational databases, an HTTP server, and HTML views.

By design, Rails does not define conventions for structuring business logic and domain-specific code, leaving developers to define their own architecture and best practices for a sustainable codebase.

@amicojeko
amicojeko / wait_for_turbo.rb
Last active February 3, 2022 13:22
waits for the turbo progress bar to show and disappear
def wait_for_turbo
has_css?('.turbo-progress-bar', visible: true)
has_no_css?('.turbo-progress-bar')
end
@amicojeko
amicojeko / clipboard.rb
Last active February 2, 2021 08:57
Copy to clipboard with Ruby
# Windows and WSL
def clip_copy(input)
str = input.to_s
IO.popen('clip.exe', 'w') { |f| f << str }
str
end
# Mac
@amicojeko
amicojeko / rgbLed.ino
Created November 28, 2020 18:07
RGB Led effects experiment
int redPin = 9;
int greenPin = 10;
int bluePin = 11;
int buttonPin = 2;
int buttonState = 0;
int lastButtonState = 0;
char cmdBuffer[2];
int counter = 0;