Skip to content

Instantly share code, notes, and snippets.

View SwagDevOps's full-sized avatar

Dimitri Arrigoni SwagDevOps

  • Colmar, France
  • 07:50 (UTC +02:00)
View GitHub Profile
@inferno
inferno / Rakefile
Created June 25, 2012 12:47
Rake task for show defined routes in Sinatra
desc 'List defined routes'
task 'routes' do
App::routes.each_pair do |method, list|
puts ":: #{method} ::"
routes = []
list.each do |item|
source = item[0].source
item[1].each do |s|
source.sub!(/\(.+?\)/, ':'+s)
@51114u9
51114u9 / speed_firefox
Last active October 6, 2020 20:13
Script to optimize the SQLite databases in Firefox
1. Close Firefox
2. Execute this:
find ~/.mozilla/firefox/ -type f -name '*.sqlite' -exec sqlite3 {} 'VACUUM;' \;

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@mudge
mudge / gist:786953
Last active November 3, 2021 08:59
How to pass blocks between methods in Ruby < 3.0.0 without using &block arguments.
# UPDATE: The ability to call Proc.new without a block was removed in Ruby 3.0.0
# See https://bugs.ruby-lang.org/issues/10499 for more information.
# So you might have heard that this is slow:
#
# def some_method(&block)
# block.call
# end
#
# Compared to:
@koraktor
koraktor / git-create-empty-branch.sh
Created March 26, 2009 08:04
Git: Creating an empty branch
git stash # Stash changes if any
git symbolic-ref HEAD refs/heads/${NEW_BRANCH} # Change head to a new, non-existing ref
git rm -rf . # Delete files from version control and working directory
rm -r . # Delete files from file system
git commit --allow-empty -m "Created new branch ${NEW_BRANCH}" # Commit changes in the new branch