Skip to content

Instantly share code, notes, and snippets.

View benoitjpnet's full-sized avatar
🇯🇵
Working from home

Benoit benoitjpnet

🇯🇵
Working from home
View GitHub Profile

convert google takeout archive for location history from kml to gpx and split file into one per day

gpsbabel -i kml -f Location\ History.kml -o gpx -F out.gpx
gpsbabel -t -i gpx -f out.gpx -x track,merge,pack,split,title="ACTIVE LOG # %Y%m%d" -o gpx -F split.gpx
python2 gpxsplitter.py split.gpx
@benoitjpnet
benoitjpnet / check_http_many.sh
Last active August 29, 2015 14:11
Nagios wrapper for check_http and other http related checks.
#!/bin/bash
result=/tmp/nagios.check_http_many.result
trap "rm ${result}*" EXIT
warning=false
critical=false
check_state() {
if [[ $1 -eq 0 ]]; then
@benoitjpnet
benoitjpnet / POSTSuspect.sh
Created October 20, 2014 13:46
Search for suspects POST in apache.log (often attacks)
grep -Eo '"POST .*.php' access.log | grep -ve cron -e login -e admin -e xmlrpc -e trackback -e comment -e 404 | sort -u
grep '"POST ' access.log | grep -ve cron -e login -e admin -e xmlrpc -e trackback -e comment -e 404
@benoitjpnet
benoitjpnet / repairmysql.sh
Created July 9, 2014 09:38
Check for crashed MySQL table in syslog and launch a repair.
#!/bin/bash
tables=$(grep crashed /var/log/syslog | grep -Eo \'\./.*\' --color=auto | sed s#\'./## | sed s#\'## | uniq | tr -s '\n' ' ')
for tableC in $tables; do
db=${tableC%/*}
table=${tableC#*/}
mysqlcheck --auto-repair --check $db $table
done
@benoitjpnet
benoitjpnet / addmailsvmail.sh
Created July 1, 2014 12:50
add mails vmail
#!/bin/bash
regex="(.*);(.*);(.*)"
#regex2=";([^\"]+)"
lastuidNumber=2024
while read line; do
[[ $line =~ $regex ]]
# Get name
name=${BASH_REMATCH[2]}
# Get uid
@benoitjpnet
benoitjpnet / dhclient.sh
Last active August 29, 2015 14:02
online IPv6 sucks :(
#!/bin/bash
# Relaunch dhclient when it crash...
mailaddr="jdoe@example.Com"
IPv6=true
pgrep -f dhclient6 > /dev/null
status=$?
if [[ $status != 0 ]]; then
IPv6=false
@benoitjpnet
benoitjpnet / bridge-fbx6hd
Last active August 29, 2015 13:56
Bridge to analyze network trafic from Freebox v6 Player and Freebox v6 Server
# brctl addbr br0
# brctl adif br0 eth0
# brctl adif br0 eth1
# ifconfig br0 up
# brctl show br0
bridge name bridge id STP enabled interfaces
br0 8000.0000aa002005 no eth0
eth1
$ aacskeys -va /media/bd
aacskeys 0.4.0e by arnezami, KenD00, Key, Nobu1789
Current path: /usr/share/aacskeys
MKBv: 12
Device key: 810827A76E5B2CC1685E3217A23E2186
Processing key: 973940BB180E83266231EE596CEF65B2
Encrypted C-value: 3F68BC4C168C01CDF97C55D08B5BE16C
Corresponding uv: 00000080
# Yout need to register a repository.
# This action need to be only done one time.
# $ curl -XPUT 'http://localhost:9200/_snapshot/backup' -d '{
# "type": "fs",
# "settings": {
# "location": "/home/backup/elasticsearch",
# "compress": true
# }
# }'