Skip to content

Instantly share code, notes, and snippets.

View LaurentDumont's full-sized avatar
:shipit:

Laurent Dumont LaurentDumont

:shipit:
View GitHub Profile
# Resize the disk in Vmware potato
# Confirm that the OS sees the new size
root@docker01:~# echo 1 > /sys/class/block/sda/device/rescan
root@docker01:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 64M 1 loop /snap/core20/2318
loop1 7:1 0 91.9M 1 loop /snap/lxd/29619
loop3 7:3 0 91.9M 1 loop /snap/lxd/24061
from fastapi import FastAPI, Request, BackgroundTasks, Depends
from fastapi.responses import JSONResponse
from fastapi.staticfiles import StaticFiles
from fastapi.templating import Jinja2Templates
import re
from bs4 import BeautifulSoup
import requests
templates = Jinja2Templates(directory="./templates")
@LaurentDumont
LaurentDumont / gist:9559ceabefb986756b75738d969afdba
Created May 1, 2019 03:28
Simpy scapy DHCP Discover packet.
from scapy.layers.inet import IP, TCP, Ether, UDP
from scapy.layers.dhcp import BOOTP, DHCP
from scapy.all import send, sendp, RandMAC
#discover = Ether(dst='ff:ff:ff:ff:ff:ff', src='DE:EA:DE:C0:FF:EE', type=0x0800)/IP(src='0.0.0.0', dst='255.255.255.255' )/UDP(dport=67,sport=68)/BOOTP(op=1,chaddr='DE:EA:DE:C0:FF:EE')/DHCP(options=[('message-type','discover'), ('end')])
#send(discover,iface="wlp3s0")
src_mac = str(RandMAC())
ethernet = Ether(dst='ff:ff:ff:ff:ff:ff', src=src_mac, type=0x800)
@LaurentDumont
LaurentDumont / rules-both.iptables
Created March 26, 2019 23:38 — forked from jirutka/rules-both.iptables
Basic iptables template for ordinary servers (both IPv4 and IPv6)
###############################################################################
# The MIT License
#
# Copyright 2012-2014 Jakub Jirutka <jakub@jirutka.cz>.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
2019-03-10 20:32:00.961 4967 INFO os_vif [-] Loaded VIF plugins: ovs, linux_bridge, noop
2019-03-10 20:49:35.697 15208 DEBUG os_vif [-] Loaded VIF plugin class '<class 'vif_plug_ovs.ovs.OvsPlugin'>' with name 'ovs' initialize /usr/lib/python2.7/site-packages/os_vif/__init__.py:46
2019-03-10 20:49:35.698 15208 DEBUG os_vif [-] Loaded VIF plugin class '<class 'vif_plug_linux_bridge.linux_bridge.LinuxBridgePlugin'>' with name 'linux_bridge' initialize /usr/lib/python2.7/site-packages/os_vif/__init__.py:46
2019-03-10 20:49:35.698 15208 DEBUG os_vif [-] Loaded VIF plugin class '<class 'vif_plug_noop.noop.NoOpPlugin'>' with name 'noop' initialize /usr/lib/python2.7/site-packages/os_vif/__init__.py:46
2019-03-10 20:49:35.698 15208 INFO os_vif [-] Loaded VIF plugins: ovs, linux_bridge, noop
@LaurentDumont
LaurentDumont / install-ansible.sh
Created December 23, 2018 00:04
Shell Script - Install Ansible
#Install Ansible
#!/bin/bash
sudo apt-get install dirmngr
echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main" | sudo tee -a /etc/apt/sources.list.d/ansible.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367
sudo apt-get update
sudo apt-get install ansible -y
@LaurentDumont
LaurentDumont / install-docker.sh
Last active December 28, 2018 20:25
Shell script - Install Docker
#Install docker
#!/bin/bash
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
software-properties-common -y
@LaurentDumont
LaurentDumont / mitigate-meltdown.yml
Created January 5, 2018 01:03 — forked from mnaser/mitigate-meltdown.yml
Ansible playbook for Meltdown mitigation (KPI for CentOS/RHEL 7)
---
- hosts: all
gather_facts: false
pre_tasks:
- name: ensure ipmi tools are installed
yum:
name: ipmitool
- name: retrieve ipmitool address
shell: >
ipmitool lan print | grep '^IP Addr' | grep -v Source | cut -d':' -f2 | xargs