Skip to content

Instantly share code, notes, and snippets.

View germainlefebvre4's full-sized avatar

Germain Lefebvre germainlefebvre4

  • Lille
View GitHub Profile
@germainlefebvre4
germainlefebvre4 / Linux Static IP
Created June 29, 2014 13:42
Comment configurer une adresse IP statique sur CentOS 6
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
@germainlefebvre4
germainlefebvre4 / Wordpress_Shortcode_Lister_Brouillons
Last active August 29, 2015 14:04
Wordpress : Créer un shortcode pour lister les articles en brouillon
------------------------------------------------------------
Wordpress
------------------------------------------------------------
Créer un [Shortcode] pour lister les articles en brouillon
------------------------------------------------------------
<?php
function shortcode_brouillons($param) {
@germainlefebvre4
germainlefebvre4 / selenium_first-step.py
Last active September 29, 2018 14:53
Selenium Python - First-Step : Very simple example
#!/usr/bin/python2
from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
driver = webdriver.Chrome('chromedriver', chrome_options=chrome_options, service_args=['--verbose', '--log-path=/tmp/chromedriver.log'])
driver.get('https://python.org')
@germainlefebvre4
germainlefebvre4 / selenium_first-step.sh
Last active September 30, 2018 19:07
Selenium Python - First-Step - Centos 7 dependencies
# Centos 7
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum-config-manager --enable epel
yum install -y vim wget unzip git python34 python34-pip # python34-devel
mkdir /opt/chromedriver
wget https://chromedriver.storage.googleapis.com/2.42/chromedriver_linux64.zip
unzip chromedriver_linux64.zip -d /opt/chromedriver
rm -f chromedriver_linux64.zip
mv /opt/chromedriver/chromedriver /opt/chromedriver/chromedriver-2.42
@germainlefebvre4
germainlefebvre4 / parse_auchan-products
Created September 29, 2018 22:36
Selenium Python - Parse Auchan Products with configurable sotres and products
#!/usr/bin/python3
import re
from selenium import webdriver
list_stores = [
"https://www.auchandrive.fr/drive/mag/update-924",
]
list_products = [
"https://www.auchandrive.fr/catalog/coca-cola-zero-1l-P762493",
# My dependencies
yum install -y telnet mlocate
# Prepare system
setenforce 0
swapoff `cat /etc/fstab | grep swap | awk '{print $1}'`
cat <<EOF > /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
# Uninstall everything
docker stop $(docker ps -aq)
docker rm $(docker ps -aq)
yum remove -y kubeadm kubelet kubectl
yum remove -y docker-ce docker
rm -rf /etc/kubernetes/ /var/lib/kubelet/ /etc/systemd/system/kubelet.service.d /etc/systemd/system/multi-user.target.wants/kubelet.service /var/lib/kubelet/ /var/log/containers /var/log/pods /usr/bin/kubelet /usr/libexec/kubernetes /etc/systemd/system/kubelet.service /etc/yum.repos.d/kubernetes.repo
rm -rf /var/lib/docker
# Install Kubernetes Cluster
# Targets: Master + Workers
# Prepare system
# Disable SELinuw
setenforce 0
sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
# Disable Swap
# Request your access_token (expires every 10-15 minutes)
curl -X POST -s "https://auth.tado.com/oauth/token" -d client_id=tado-web-app -d grant_type=password -d client_secret=xxxxxxxxx -d 'username=my@email.com' -d 'password=myPassword' -d scope=home.user
{"access_token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1YzIyOTliNmQ2MDE4MDAwMDg4ZGJhNGEiLCJ0YWRvX2hvbWVzIjpbeyJpZCI6MjgzNzg3fV0sImlzcyI6InRhZG8iLCJsb2NhbGUiOiJmciIsImF1ZCI6InBhcnRuZXIiLCJuYmYiOjE1NDU4NjI4NTQsInRhZG9fc2NvcGUiOlsiaG9tZS51c2VyIl0sInRhZG9fdXNlcm5hbWUiOiJnZXJtYWluLmxlZmVidnJlNEBnbWFpbC5jb20iLCJuYW1lIjoiR2VybWFpbiBMZWZlYnZyZSIsImV4cCI6MTU0NTg2MzQ1NCwiaWF0IjoxNTQ1ODYyODU0LCJ0YWRvX2NsaWVudF9pZCI6InRhZG8td2ViLWFwcCIsImp0aSI6IjEzYzdlOTA4LTQzOWEtNDA5OC04OWMyLTZmNWFlYjhlODM5NyIsImVtYWlsIjoiZ2VybWFpbi5sZWZlYnZyZTRAZ21haWwuY29tIn0.Otrk9iAM3AM3suRTGgYh9FcTL1onsD3wEbHAHhBv1RD9mTnFv_Uds-NOXtZJpWApq_R0i5d-Lfy64UCdN3EW5DEb8QaCyvwmjOpgFEU1WvRNamh_dZGzB_AwCkI10qVe5qSpKL-_I51zxUsLmhOubfUJZE9wjBNVDMXVyq8vX-rzFIrJH3dfdgTalYyUYlrU3oBs2Q5eSCzR8dh09fBfIC_vy
@germainlefebvre4
germainlefebvre4 / aws-billing_influxdb.py
Last active April 19, 2019 12:41
Collect billing costs for each AWS Accounts registered and push dataset in InfluxDB
#!/usr/bin/env python
# Author: Germain LEFEBVRE [Ineat]
# Prerequisites
# 00 - Create API Access Key in AWS Accounts to monitor
# 00 - Fill ~/.aws/credentials with API Access Keys
# 01 - Fill ./config.yml 'aws_account' dict with aws profiles or access/secret key as following:
# aws_accounts:
# - name: Ineat iLab
# profile: INEAT_ILAB