Skip to content

Instantly share code, notes, and snippets.

View hugolepetit's full-sized avatar

Hugo Lepetit hugolepetit

View GitHub Profile
@camh-
camh- / eol-at-eof.md
Created March 7, 2020 04:41
Please add newlines at end of files

See https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline

A newline in a text file is a terminator, not a separator. This means each line should have a newline at the end of it, including the last line of the file.

Many editors automatically add the newline at the end of the file. Some do not. If you can configure your editor to ensure there is always a newline at the end of every line, please do so.

Because many editors do add this newline, if you commit a text file without it, when someone else edits the file, their editor will (correctly) add the newline. This causes a spurious diff in the file. Spurious

@cquest
cquest / siret_histo.sh
Last active February 28, 2018 22:25
Extraction des changements de SIRET des fichiers SIRENE quotidiens
# extraction des changements de SIRET dans les fichiers de maj quotidien SIRENE
# génère un fichier CSV avec SIRET_OLD, SIRET_NEW et DATEMAJ
# unzip = décompression du zip
# csvcut = ectraction des colonnes qui nous intéressent + conformation CSV
# egrep = extraction de slignes qui nous intéressent
# csvsql = rapprochement pour obtenir le lien ancien -> nouveau SIRET
FILE=$(echo $1 | sed 's/.zip//')
unzip $1
@Haelle
Haelle / checklists_for_software_development.md
Last active July 16, 2017 17:12
Checklists for Software Development

Checklists for Software Development

Patrick Joyce - pragmati.st/checklists

Before Submitting a Pull Request

THE SUBMITTER SHOULD ALWAYS ASK THEMSELVES THE FOLLOWING QUESTIONS:

  • Have I looked at every line of the diff between your branch and master?
  • Is there anything in this patch that is not related to the overall change?
  • Have I structured the commits to make the reviewer’s job easy?
  • Have I tested the code locally?
  • Should QA look at this before I submit it for review?

Bonjour ! Nous allons travailler ensemble, le présent document vous permettra de cerner nos attentes et recommandations.

En selle !

Faisons connaissance, et échangeons les contacts des responsables techniques pour adresser les emails aux destinataires concernés ainsi que leurs fonctions. Il est bon de mieux se connaitre avant de travailler ensemble, cela permet aussi d'indiquer vos disponibilités et indisponibilités futures.

Prenons contact

Voici un exemple de mail de prise de contact permettant de bien démarrer le projet.

Objet : prise de contact

@cquest
cquest / db_utils.sql
Last active September 18, 2017 14:15
postgresql VIEW to explore table/index bloat and size of data/index and use of index (# of index scans)
-- SELECT * FROM db_size; -- list tables/index with the disk space occupied
-- SELECT * FROM db_bloat; -- compute lost space in data/index
-- SELECT * FROM db_stats; -- show size of data/index + number of reads (data) or index scans
-- SELECT * FROM db_index_list ; -- show original CREATE INDEX statement
CREATE OR REPLACE VIEW db_bloat AS
SELECT current_database() AS current_database,
sml.schemaname,
sml.tablename,
round(
/* VT100 terminal reset (<ESC>c) */
console.log('\033c');
/* numbers comparations */
> '2' == 2
true
> '2' === 2
@hopsoft
hopsoft / db.rake
Last active May 6, 2024 14:00
Rails rake tasks for dump & restore of PostgreSQL databases
# lib/tasks/db.rake
namespace :db do
desc "Dumps the database to db/APP_NAME.dump"
task :dump => :environment do
cmd = nil
with_config do |app, host, db, user|
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump"
end
puts cmd
class Module
def dispatch(*klasses, last)
last_klass, mid = last.first
klasses << last_klass
__dispatch_list << [klasses, instance_method(mid)]
define_method(mid, __dispatch_proc(__dispatch_list))
end
def __dispatch_list
@__dispatch_list ||= []