Skip to content

Instantly share code, notes, and snippets.

View mvisonneau's full-sized avatar

Maxime VISONNEAU mvisonneau

View GitHub Profile
@mvisonneau
mvisonneau / gist:a2e738ea6523303c5322
Created November 10, 2014 14:19
Free space from locked files without restarting process
root@hostname:/var/log# df -h | grep lv_var
/dev/rootvg/lv_var 992M 943M 0 100% /var
root@hostname:~# pidof mysqld
17431
root@hostname:~# lsof -p 17431 | grep deleted
mysqld 17431 mysql 1w REG 252,5 1 32994 /var/log/mysql/error.log.1 (deleted)
mysqld 17431 mysql 2w REG 252,5 1 32994 /var/log/mysql/error.log.1 (deleted)
mysqld 17431 mysql 4w REG 252,5 1 32987 /var/log/mysql/mysql-slow.log.1 (deleted)
@mvisonneau
mvisonneau / addPackage.sh
Created March 5, 2015 11:12
Add and sign package into a repo debian
#!/bin/sh
#########
cd /data/seres
rm -f InRelease Release.gpg
dpkg-sig --sign builder $1
apt-ftparchive packages . > Packages
gzip -c Packages > Packages.gz
apt-ftparchive release . > Release
gpg --clearsign -o InRelease Release
@mvisonneau
mvisonneau / config
Created March 17, 2015 13:09
Terminator Config File
[global_config]
suppress_multiple_term_dialog = True
title_transmit_bg_color = "#839496"
title_inactive_fg_color = "#93a1a1"
title_transmit_fg_color = "#eee8d5"
title_inactive_bg_color = "#586e75"
[keybindings]
[profiles]
[[default]]
palette = "#073642:#d30102:#859900:#b58900:#6c71c4:#d33682:#2aa198:#839496:#586e75:#cb4b16:#859900:#b58900:#268bd2:#d33682:#2aa198:#93a1a1"
@mvisonneau
mvisonneau / Vagrantfile
Created March 23, 2015 12:49
Multiple Machines Vagrant
Vagrant.configure("2") do |config|
config.vm.define :centos do |centos|
centos.vm.box = "centos64"
end
config.vm.define :ubuntu do |ubuntu|
ubuntu.vm.box = "ubuntu/trusty64"
end
end
@mvisonneau
mvisonneau / Vagrantfile
Last active August 29, 2015 14:17
Salt Vagrant File
# Configuration for minion
minion_count = 3
vb_gui = false
minion_memory = 512
minion_cpus = 1
Vagrant.configure(2) do |config|
# Define box settings
config.vm.box = "ubuntu/trusty64"
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1
mQGiBEsm3aERBACyB1E9ixebIMRGtmD45c6c/wi2IVIa6O3G1f6cyHH4ump6ejOi
AX63hhEs4MUCGO7KnON1hpjuNN7MQZtGTJC0iX97X2Mk+IwB1KmBYN9sS/OqhA5C
itj2RAkug4PFHR9dy21v0flj66KjBS3GpuOadpcrZ/k0g7Zi6t7kDWV0hwCgxCa2
f/ESC2MN3q3j9hfMTBhhDCsD/3+iOxtDAUlPMIH50MdK5yqagdj8V/sxaHJ5u/zw
YQunRlhB9f9QUFfhfnjRn8wjeYasMARDctCde5nbx3Pc+nRIXoB4D1Z1ZxRzR/lb
7S4i8KRr9xhommFnDv/egkx+7X1aFp1f2wN2DQ4ecGF4EAAVHwFz8H4eQgsbLsa6
7DV3BACj1cBwCf8tckWsvFtQfCP4CiBB50Ku49MU2Nfwq7durfIiePF4IIYRDZgg
@mvisonneau
mvisonneau / pfcheck.sh
Created June 24, 2015 14:20
Puppetfile version checker
#!/bin/bash
###########
OK='\033[0;32m'
NOK='\033[0;31m'
NC='\033[0m'
vercomp () {
if [[ $1 == $2 ]]
then
ebug: Executing '/etc/init.d/iptables-persistent status'
Debug: Prefetching iptables resources for firewall
Debug: Puppet::Type::Firewall::ProviderIptables: [prefetch(resources)]
Debug: Puppet::Type::Firewall::ProviderIptables: [instances]
Debug: Executing '/sbin/iptables-save'
Error: Could not prefetch firewall provider 'iptables': can't dup NilClass
Debug: Puppet::Type::Firewall::ProviderIptables: [instances]
Debug: Executing '/sbin/iptables-save'
Error: /Firewall[999 drop multicast]: Could not evaluate: can't dup NilClass
Debug: Puppet::Type::Firewall::ProviderIptables: [instances]
@mvisonneau
mvisonneau / random_unique_range.php
Created June 14, 2016 22:16
generate_random_unique_range
<?php
$min = 1 ;
$max = 99999 ;
$array = range($min, $max);
function getRandomUnusedNumber( $array, $min, $max ) {
$i = rand( $min, $max ) ;
if( isset( $array[$i] ) )
return $array[$i] ;
@mvisonneau
mvisonneau / gitlab_to_jira.py
Created August 11, 2017 15:54
GitLab to Jira issue sync
#!/usr/bin/env python
import gitlab
from jira import JIRA
import urllib3
## Disable urllib3 ssl checks warnings
urllib3.disable_warnings( urllib3.exceptions.InsecureRequestWarning )
## GitLab config