This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# frozen_string_literal: true | |
# prendre les 9 premiers chiffres, exception si plus ou moins que 9 chiffres | |
SIREN = ARGV[0] | |
# calculer la clé | |
key = (12 + 3 * (SIREN.to_i % 97)) % 97 | |
# concaténer et prévixer de "FR" pour la france | |
tva = "FR#{key}#{SIREN}" | |
puts tva |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kill $(ps aux | grep ruby | awk '{print $2}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\list or \l - to display databases | |
\connect or \c database_name - to connect to a database | |
\dn - list of schemas | |
SHOW search_path; | |
SET search_path TO xxxxxx; | |
\dt - to list tables |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pg_dump {database} > {dump_name}.sql -U {dbuser} -h {host} | |
psql -p {port} -d {database} -U {dbuser} -W -f {dump_name}.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo locale-gen fr_FR fr_FR.UTF-8 | |
Generating locales... | |
fr_FR.ISO-8859-1... done | |
fr_FR.UTF-8... done | |
Generation complete. | |
$ sudo dpkg-reconfigure locales | |
Generating locales... | |
fr_FR.ISO-8859-1... up-to-date | |
fr_FR.UTF-8... up-to-date |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Your working on your workstation, your *nix username is "mat". You want to install gitolite on a server | |
1) go to your server, and with admin rights, create a git user. On ubuntu: | |
adduser git | |
2) on your workstation, copy you local SSH public key to the git home directory. On ubuntu: | |
ssh-copy-id -i ~/.ssh/id_rsa.pub git@server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class String | |
UNACCENT_HASH = { | |
'A' => 'ÀÁÂÃÄÅĀĂǍẠẢẤẦẨẪẬẮẰẲẴẶǺĄ', | |
'a' => 'àáâãäåāăǎạảấầẩẫậắằẳẵặǻą', | |
'C' => 'ÇĆĈĊČ', | |
'c' => 'çćĉċč', | |
'D' => 'ÐĎĐ', | |
'd' => 'ďđ', | |
'E' => 'ÈÉÊËĒĔĖĘĚẸẺẼẾỀỂỄỆ', | |
'e' => 'èéêëēĕėęěẹẻẽếềểễệ', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
postgres=# GRANT USAGE ON LANGUAGE c TO rails; | |
ERREUR: le langage « c » n'est pas de confiance | |
ASTUCE : Seuls les super-utilisateurs peuvent utiliser des langages qui ne sont pas | |
de confiance. | |
postgres=# UPDATE pg_language SET lanpltrusted = true WHERE lanname = 'c'; | |
UPDATE 1 | |
postgres=# GRANT USAGE ON LANGUAGE c TO rails; | |
GRANT |