Skip to content

Instantly share code, notes, and snippets.

View Elektordi's full-sized avatar

Guillaume "Elektordi" Genty Elektordi

View GitHub Profile
@Elektordi
Elektordi / post-receive
Last active January 19, 2016 01:36
How to update production files on push from your computer (when your servers can't reach your git server)
#!/bin/sh
# Copy me at .git/hooks/post-receive
# And remember to set this in .git/config:
#
#[receive]
# denyCurrentBranch = no
# Working directory is .git
#!/bin/bash
# Comment installer le script ?
#
# Copier le contenu dans /etc/network/if-up.d/000-fog-moi-le-hostname
mac=`ifconfig eth0 | grep HWaddr | sed -e "s/.* HWaddr //"`
oldhost=`hostname`
tmp=/tmp/fog-hostname
fogserver=fogserver.plasci.local
@Elektordi
Elektordi / fix_utf8.py
Last active August 17, 2016 21:59
Fix UTF-8 texts on a mailman setup (after a failed upgrade...)
#!/usr/bin/python
#
# Copyright (C) 2002 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@Elektordi
Elektordi / videojdn2016.hex
Created November 20, 2016 17:05
videojdn2016.hex
00000000 fc fb fb ac 59 d1 74 29 af 88 5b 2b 08 00 45 00 |....Y.t)..[+..E.|
00000010 00 72 69 23 00 00 80 11 c3 a1 c0 a8 46 64 c0 a8 |.ri#........Fd..|
00000020 46 01 ff fc 10 92 00 5e 38 7d 50 75 74 61 69 6e |F......^8}Putain|
00000030 20 4d 61 72 63 20 74 75 20 66 61 69 73 20 63 68 | Marc tu fais ch|
00000040 69 65 72 21 54 48 45 20 47 41 4d 45 50 48 50 20 |ier!THE GAMEPHP |
00000050 63 27 65 73 74 20 64 65 20 6c 61 20 6d 65 72 64 |c'est de la merd|
00000060 65 56 6f 73 20 6a 65 75 64 69 73 20 61 70 72 65 |eVos jeudis apre|
00000070 6d 20 73 65 72 6f 6e 74 20 6c 69 62 65 72 65 73 |m seront liberes|
@Elektordi
Elektordi / dxf2csv.py
Created March 14, 2017 14:47
Mass convert of lines from Lambert2 DXF to WKT CSV
#!/usr/bin/env python
import sys
import ezdxf
import re
from osgeo import gdal,ogr,osr
import math
def reproject(x, y, inputEPSG, outputEPSG):
inSpatialRef = osr.SpatialReference()
@Elektordi
Elektordi / rawatm2sunatm.py
Last active May 16, 2017 20:08
Convert raw atm pcap files (from GNS3) to sun atm (for Wireshark)
#!/usr/bin/env python
import sys
import struct
from scapy.all import *
inputfile = ''
outputfile = ''
if len(sys.argv) < 3:
print 'Usage: ./rawatm2sunatm.py <inputfile> <outputfile>'
@Elektordi
Elektordi / srcds.py
Created June 8, 2017 15:53
Source RCON client lib converted to Python 3.7
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Reference: https://github.com/frostschutz/SourceLib/blob/master/SourceRcon.py
# Converted to Python3 by Guillaume "Elektordi" Genty (Tested on 3.7)
#------------------------------------------------------------------------------
# SourceRcon - Python class for executing commands on Source Dedicated Servers
# Copyright (c) 2010 Andreas Klauer <Andreas.Klauer@metamorpher.de>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
@Elektordi
Elektordi / meraki.py
Created September 14, 2017 16:48
Python class to access Meraki dashboard as objects
import logging
import httplib
import json
import re
from urlparse import urlparse
LOGGING_NAME = "meraki"
LOG = logging.getLogger("%s.%s" % (LOGGING_NAME, __name__))
class dashboard:
@Elektordi
Elektordi / printbarcode.sh
Created March 7, 2018 13:42
Print barcode on DYMO label printer
#!/bin/bash
if [ $# -eq 1 ]
then
( echo "%!PS-Adobe-2.0 EPSF-2.0
%%Creator: dytextlab, derived from fig2dev Version 3.2 Patchlevel 5-alpha7
%%BoundingBox: 0 0 5769 52
%%EndComments
newpath
@Elektordi
Elektordi / gggraph.php
Created June 1, 2018 12:46
Custom cacti-like graphs for observium
<?php
$observium = "/var/www/observium";
$padoffset = 30;
if(empty($_GET['graph'])) die('Missing graph parameter.');
$graph = $_GET['graph'];
$ds = '';
if($graph=='in') {