Skip to content

Instantly share code, notes, and snippets.

View czj's full-sized avatar

Clément Joubert czj

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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 / assurance-auto-souscription-facile.md
Created September 13, 2016 07:52
Comment bien gérer la souscription d'un contrat d'assurance auto

• Autofill de tes informations d'après ton numéro de plaque d'immatriculation. • Autofill du code BIC d'après ton IBAN • Autofill de l'adresse de ton ancienne assurance auto d'après son nom (pour résilier pour toi) • Auto-résiliation du contrat précédent • Signature en ligne du contrat d'assurance auto ET du mandat de prélèvement • Auto-création d'un compte sans prise de tête • Auto association de ton devis demandé à pétarouchnok avec ton compte client existant et/ou nouvellement créé (lié via email) comme chez Amaguiz • Upload drag & drop pour déposer les scans de tes justificatifs d'assurance passée & de carte grise • Ticket CB par mail en PDF de ton paiement d'assurance temporaire

@czj
czj / assurance-auto-souscription-facile.md
Last active September 13, 2016 07:59
Comment bien gérer la souscription d'un contrat d'assurance auto
  • Ajout dans "mon compte" du devis même si réalisé sur comparateur de prix
  • Auto-création du compte même si devis réalisé sur comparateur de prix
  • Auto-résiliation du contrat précédent avec remplissage automatique de l'adresse de l'ancien assureur d'après son nom
  • Remplissage automatique du code BIC d'après ton IBAN
  • Remplissage automatique des informations voiture d'après numéro d'immatriculation.
  • Signature en ligne du contrat d'assurance auto ET du mandat de prélèvement
  • Ticket CB par mail en PDF de ton paiement d'assurance temporaire
  • Upload drag & drop pour déposer les scans de tes justificatifs d'assurance passée & de carte grise
  • Documents PDF à nom de fichier explicites, et directement attachés aux emails
@czj
czj / solano.yml
Created December 13, 2016 20:05
Solano CI sample Ruby + Rails + PostgreSQL configuration
ruby_version: ruby-2.3.3p222
bundler_version: 1.13.6
# hooks:
# worker_setup: bundle exec rake db:setup # Runs once for each worker to do, e.g., database setup
# post_setup: bundle exec rake assets:precompile # Runs once before tests and after worker_setup
# post_build: bundle exec rake heroku:deploy # Runs once after entire build completes
postgresql:
version: '9.4'