Skip to content

Instantly share code, notes, and snippets.

Julien Letessier mezis

Block or report user

Report or block mezis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mezis
mezis / gist:6967407
Created Oct 13, 2013
Rubinius 2.0.0 with RBenv + ruby-build plugin
View gist:6967407
# in ~/.rbenv/rbenv.d/rehash/rbx-2.0.0.bash
make_shims "~/.rbenv/versions/rbx-2.0.0/gems/bin/*"
# in ~/.rbenv/rbenv.d/which/rbx-2.0.0.bash
if [ ! -x "$RBENV_COMMAND_PATH" ] && [[ $RBENV_VERSION =~ rbx-2 ]]; then
export RBENV_COMMAND_PATH="${RBENV_ROOT}/versions/${RBENV_VERSION}/gems/bin/${RBENV_COMMAND}"
fi
View he
#!/usr/bin/env ruby
#
# Heroku wrapper
#
require 'pathname'
app_basename = Pathname.new('.').realpath.basename.to_s
head_name = %x(git symbolic-ref HEAD).strip
branch_name = head_name.gsub(%r(^refs/heads/), '')
@mezis
mezis / deploy.rb.diff
Created Jan 21, 2014
Restart servers in a staggered manner.
View deploy.rb.diff
diff --git i/config/deploy.rb w/config/deploy.rb
index 73fc910..594322c 100644
--- i/config/deploy.rb
+++ w/config/deploy.rb
@@ -65,7 +65,7 @@ end
desc 'restart'
deploy.task :restart, :roles => :web do
- run "touch #{current_path}/tmp/restart.txt"
+ run "bash -c 'sleep $(( $RANDOM / 100 ))' ; date ; touch #{current_path}/tmp/restart.txt"
View -
class TunesFillfactor < ActiveRecord::Migration
TABLES = %w[orders restaurant_assignment order_assignment order_item driver zone_metrics]
def up
TABLES.each do |table|
execute %{ALTER TABLE #{table} SET (fillfactor = 85)}
end
end
def down
@mezis
mezis / results.txt
Created Aug 23, 2016
MessagePack, JSON, YAML, Protobuf, BSON, Marshal: Ruby 2.3.1 benchmark results
View results.txt
Encode
======
Date: August 22, 2016
System Information
------------------
Operating System: OS X 10.11.6 (15G31)
CPU: Intel Core i7 2.5 GHz
Processor Count:
Memory: 16 GB
View run-backfill.rb
#!/usr/bin/env ruby
puts "Press RETURN when the geocoder cache has been unpacked in tmp/cache/geocoder"
gets
Geocoder.config[:cache] = ActiveSupport::Cache::FileStore.new('tmp/cache/geocoder')
puts "Paste the correct Google API key:"
Geocoder.config[:api_key] = gets.strip
BackfillUserCityAreaService.new.run
@mezis
mezis / git-chop.sh
Created Feb 9, 2012
Close a feature branch - removing it from local and remote
View git-chop.sh
#!/bin/bash
#
# Close a feature branch - removing it from local and remote.
#
die() {
echo "$@" ; exit 1
}
head=$(git symbolic-ref HEAD 2> /dev/null || git log -1 --format=%h)
@mezis
mezis / git-list-branches.sh
Created Jan 19, 2012
List all remote local or branches in your repo, along with colourful freshness information!
View git-list-branches.sh
#!/bin/bash
#
# List branch status and age against an integration branch.
#
# Copyright (C) 2012 Julien Letessier
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
@mezis
mezis / git-merge-po.sh
Last active Jan 10, 2019
Git merge driver for PO files
View git-merge-po.sh
#!/bin/sh
#
# *******************************************
# WARNING: this does *not* handle 3-way merges properly.
# Anything modified on the local branch since the common base will get ignored.
#
# FOR ANYONE LANDING HERE:
# This script is now updated as part of the git-whistles gem.
# https://github.com/mezis/git-whistles
# *******************************************
@mezis
mezis / query_finder.sql
Last active Sep 24, 2019
Finding long-running queries in MySQL
View query_finder.sql
SELECT id,state,command,time,left(replace(info,'\n','<lf>'),120)
FROM information_schema.processlist
WHERE command <> 'Sleep'
AND info NOT LIKE '%PROCESSLIST%'
ORDER BY time DESC LIMIT 50;
You can’t perform that action at this time.