Skip to content

Instantly share code, notes, and snippets.

View czj's full-sized avatar

Clément Joubert czj

View GitHub Profile
@czj
czj / basic.html
Created August 31, 2016 08:32
Templates Inky pour Foundation for Emails 2.0
<style type="text/css">
.header {
background: #8a8a8a;
}
.header .columns {
padding-bottom: 0;
}
.header p {
@czj
czj / shrine_attachment_version_regenerate.rb
Created August 24, 2016 15:24
Re-generate Shrine.rb attached file versions for a Rails model
# Run in smalls batches, for memory usage and to re-start on failure / SSH connexion lost
600.times { |i|
n = i * 100
puts "Processing #{n} ..."
Imaj.where(id: (n + 1)..(n + 100)).each { |e|
e.update!(picture: e.picture[:original]) if e.picture_attacher.stored?
}
}
@czj
czj / rbenv.sh
Created August 17, 2016 08:28
Massive rbenv + ruby-build upgrade/install latest ruby
cd ~/.rbenv && git checkout master && git fetch --all --prune && git pull && git gc --aggressive && cd plugins/ruby-build/ && git pull && git gc --aggressive && cd && TMPDIR="$HOME/tmp" rbenv install 2.3.1 && rbenv global 2.3.1 && gem install bundler eye
@czj
czj / video_recompress.rb
Created August 8, 2016 07:54
Recompression vidéo H264/H265
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'optparse'
require 'ostruct'
DEFAULT_X264_PARAMS = {
'b-adapt' => 2,
'ref' => 16,
'direct' => 'auto',
@czj
czj / gist:909c3fd7d3c85bcd20f7de09e91432d5
Created May 2, 2016 12:53
Content blocker source database in JSON format
{
"license": "Copyright 2010-2014 Disconnect, Inc. / This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. / This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. / You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.",
"categories": {
"Advertising": [
{
"2leep.com": {
"http://2leep.com/": [
"2leep.com"
]
}
@czj
czj / database_size.sql
Created April 4, 2016 10:04
Get PostgreSQL's current database sizes (tables, indexes)
SELECT
table_name,
pg_size_pretty(table_size) AS table_size,
pg_size_pretty(indexes_size) AS indexes_size,
pg_size_pretty(total_size) AS total_size
FROM (
SELECT
table_name,
pg_table_size(table_name) AS table_size,
pg_indexes_size(table_name) AS indexes_size,
@czj
czj / codeship_tests_runner.sh
Last active October 15, 2015 14:51
CodeShip tests pipeline runner
# Enabled the 2 test pipelines architecture
# Don't send to CodeClimate because they would get 2 reports
# We use Circle CI to do the code coverage analysis :-)
#
# 2 pipelines:
# bundle exec rake test `find test/{controllers,integration} -type f -regex ".+_test.rb"`
# bundle exec rake test `find test/{decorators,helpers,jobs,lib,mailers,models,policies,workers} -type f -regex ".+_test.rb"`
#
# 1 pipeline:
# bundle exec rake test
@czj
czj / fianet_sha1_hmac.php
Created January 16, 2015 16:06
FIA-NET / Certissim's HMAC SHA1 checksum
#!/usr/bin/php
<?php
// Check http://cl.ly/2o0z0z1G103O for documentation on Certissim's HMAC SHA1
// First parameter = hexadecimal key
$key_hex = $argv[1];
// Second = string to get signature
$payload = $argv[2];
@czj
czj / fianet_sha1_hmac.php
Created January 16, 2015 09:41
FIANET / Certissim SHA1 + HMAC signature
#!/usr/bin/php
<?php
// Check http://cl.ly/2o0z0z1G103O for documentation on Certissim's HMAC SHA1
// First parameter = hexadecimal key
$key_hex = $argv[1];
// Second = string to get signature
$payload = $argv[2];

Thanks to @alfredapp 's Web Search, you can call "0123456789" using OS X #Yosemite + iPhone on iOS8.1

Click this URI :

alfred://customsearch/Call%20%7Bquery%7D%20via%20iPhone/tel/utf8/noplus/tel:{query}