Skip to content

Instantly share code, notes, and snippets.

@ybart
ybart / gitlab-condensed-log
Last active May 11, 2026 07:28
gitlab-condensed-log: HTML git log with GitLab author avatars
#!/bin/bash
# Script to generate HTML git log with author avatars using glab CLI
# Usage: ./git_log_with_avatars.sh <git-range>
# Example: ./git_log_with_avatars.sh main..HEAD
if [ -z "$1" ]; then
echo "Usage: $0 <git-range>"
echo "Example: $0 main..HEAD"
exit 1
@ybart
ybart / _kucli
Last active May 13, 2026 13:15
kucli: multi-environment kubectl helper
#compdef kucli
_kucli() {
local config_file
local git_root=$(git rev-parse --show-toplevel 2>/dev/null)
if [[ -n "$git_root" && -f "$git_root/config/kucli.yml" ]]; then
config_file="$git_root/config/kucli.yml"
elif [[ -f "$PWD/config/kucli.yml" ]]; then
config_file="$PWD/config/kucli.yml"
@ybart
ybart / hp-ews-proxy.py
Last active April 26, 2026 00:52
HP WiFi config over USB - no HPLIP required, adaptable to other HP LaserJet/OfficeJet/Photosmart models.
#!/usr/bin/env python3
"""
HP Printer EWS USB Proxy
========================
Exposes the HP printer's Embedded Web Server (EWS) through a local HTTP proxy,
forwarding requests over USB bulk endpoints.
Useful when the printer is not yet on WiFi and its web UI is unreachable
over the network.
# Install Oh My ZSH
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# Install ruby with RVM and Homebrew
$ xcode-select --install
$ sudo xcodebuild -license
$ gcc --version
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew doctor
$ \curl -sSL https://get.rvm.io | bash -s stable --ruby
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
# Activate the gem you are reporting the issue against.
#### Contents of the preconfiguration file (for xenial)
### Localization
# Preseeding only locale sets language, country and locale.
d-i debian-installer/locale string fr_FR
# The values can also be preseeded individually for greater flexibility.
#d-i debian-installer/language string en
#d-i debian-installer/country string NL
#d-i debian-installer/locale string en_GB.UTF-8
# Optionally specify additional locales to be generated.
@ybart
ybart / config-application.rb
Last active August 29, 2015 14:14
Localizing ActionMailer::Preview
class Application < Rails::Application
...
# The easiest way : update the default locale and restart
config.i18n.default_locale = :fr
...
end
@ybart
ybart / example_root_route.rb
Last active August 29, 2015 14:13
Excerpts for URL Helpers articles
root 'welcome#index'
# Install ruby with RVM and Homebrew
$ xcode-select --install
$ gcc --version
$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
$ brew doctor
$ \curl -sSL https://get.rvm.io | bash -s stable --ruby
# Install PostgreSQL
$ brew install postgres
$ ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
function ls-refresh {
while [ 1 ]; do ls -hdl "$1"; echo -n -e "\033[1A"; sleep 1; done
}