Skip to content

Instantly share code, notes, and snippets.

View romainnorberg's full-sized avatar
🏖️

Romain romainnorberg

🏖️
  • Freelance
  • World
View GitHub Profile
#!/usr/bin/env bash
# source environment variables
# https://www.clever-cloud.com/doc/admin-console/environment-variables/
source /home/bas/applicationrc
if [ -n ${INSTANCE_TYPE} ] && [ ${INSTANCE_TYPE} = 'production' ] && [ -n ${INSTANCE_NUMBER} ] && [ ${INSTANCE_NUMBER} -eq 0 ]
then
DATE=`date +%Y%m%d-%H%M%S`
@romainnorberg
romainnorberg / Command lines
Created January 8, 2018 17:01
Generate a multi domains certificate using config files
Steps (en ligne de commande - macosx):
- `cd Desktop/`
- `openssl genrsa -out mmw.key 2048`
- `openssl req -new -out server.csr -key server.key -config openssl.cnf`
- `openssl x509 -req -days 3650 -in server.csr -signkey server.key -out server_autosign_test.crt -extensions v3_req -extfile openssl.cnf` _(autosigné, afin de vérifier la génération)_
@romainnorberg
romainnorberg / vim-heroku.sh
Created March 26, 2018 10:40 — forked from dvdbng/vim-heroku.sh
Run vim in heroku updated 2017
mkdir ~/vim
cd ~/vim
# Staically linked vim version compiled from https://github.com/ericpruitt/static-vim
# Compiled on Jul 20 2017
curl 'https://s3.amazonaws.com/bengoa/vim-static.tar.gz' | tar -xz
export VIMRUNTIME="$HOME/vim/runtime"
export PATH="$HOME/vim:$PATH"
cd -
@romainnorberg
romainnorberg / multiple_ssh_setting.md
Created March 29, 2018 08:21 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@romainnorberg
romainnorberg / regex-vs-array.php
Created May 11, 2018 07:58
Php performances test
<?php
$excludeBotsRegex = '/(googlebot|Googlebot-Mobile|Googlebot-Image|Google favicon|Mediapartners-Google|bingbot|slurp|java|wget|curl|Commons-HttpClient|Python-urllib|libwww|httpunit|nutch|phpcrawl|msnbot|jyxobot|FAST-WebCrawler|FAST Enterprise Crawler|biglotron|teoma|convera|seekbot|gigablast|exabot|ngbot|ia_archiver|GingerCrawler|webmon |httrack|webcrawler|grub.org|UsineNouvelleCrawler|antibot|netresearchserver|speedy|fluffy|bibnum.bnf|findlink|msrbot|panscient|yacybot|AISearchBot|IOI|ips-agent|tagoobot|MJ12bot|dotbot|woriobot|yanga|buzzbot|mlbot|yandexbot|purebot|Linguee Bot|Voyager|CyberPatrol|voilabot|baiduspider|citeseerxbot|spbot|twengabot|postrank|turnitinbot|scribdbot|page2rss|sitebot|linkdex|Adidxbot|blekkobot|ezooms|dotbot|Mail.RU_Bot|discobot|heritrix|findthatfile|europarchive.org|NerdByNature.Bot|sistrix crawler|ahrefsbot|Aboundex|domaincrawler|wbsearchbot|summify|ccbot|edisterbot|seznambot|ec2linkfinder|gslfbot|aihitbot|intelium_bot|facebookexternalhit|yeti|RetrevoPageAnalyzer|lb-spider|sogo
@romainnorberg
romainnorberg / pre-request-script
Last active September 4, 2019 04:32
Work with OVH-Api using Postman Pre-request scripts (Blog post: https://blog.romainnorberg.be/post/work-with-ovh-api-using-postman)
pm.sendRequest({
url: "https://api.ovh.com/1.0/auth/time",
method: "GET",
headers: {
'Content-Type': 'application/json; charset=utf-8'
},
body: {}
},
function (err, res) {

count & sort by subdocuments

db.Visitor.aggregate([
    {
        $project: {
            "n": { $size: "$history" }
        }
    }
 ,
use Symfony\Component\Mailer\Mailer;
use Symfony\Component\Mailer\Transport;
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;
use Symfony\Component\Mime\Email;
// not work
/*
$mailer = new Mailer(
Transport::fromDsn(
@romainnorberg
romainnorberg / python_mysql_avoid_injection.py
Last active January 30, 2023 19:36
(Python) Avoid SQL injection when using MySQLCursor.execute()
import mysql.connector as mdb
con = mdb.connect(
host='127.0.0.1',
port=3306,
user='root',
passwd='rootroot',
db='db', charset='utf8'
)