Skip to content

Instantly share code, notes, and snippets.

View miticojo's full-sized avatar

Giorgio Crivellari miticojo

View GitHub Profile
@miticojo
miticojo / influxdb_cpu_mem.py
Created June 23, 2016 10:49
Send to influxdb cpu and memory metrics
import argparse
from influxdb import InfluxDBClient
import time
import random
import psutil
import socket
USER = 'root'
PASSWORD = 'root'
@miticojo
miticojo / net-rollback.sh
Last active July 3, 2016 14:58
network rollback script for centos 7 (with ovs)
#!/bin/bash
netscripts="/etc/sysconfig/network-scripts"
netlock="/var/spool/network-restore.lck"
logfile="/var/log/net-rollback.log"
check_ip="8.8.8.8"
log () {
echo $1 >&2
echo "`date -u` - $1" >> $logfile
}
@miticojo
miticojo / ChangeAndUnlock.ps1
Created July 27, 2016 06:56
AD massive enable and change expired password
# This script apply a massive change of password and unlock users
Import-Module ActiveDirectory
# Set OU on which you need to apply massive change
$ou="...DC=company,DC=loc"
# Set password to set
$securePwd=ConvertTo-SecureString -String "NewPassword" -Force -AsPlainText
Get-ADUser -SearchBase $ou -Filter 'PasswordExpired -eq $true' | Set-ADAccountPassword -NewPassword $securePwd
Search-ADAccount -SearchBase $ou -LockedOut | Unlock-ADAccount
@miticojo
miticojo / etc_rsyslog.d_runabove.conf
Last active January 27, 2017 11:01
runabove syslog delivery throgh Rsyslog on Centos 6/7
# replace token xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx with the one provided by runabove management console
$template OVHFormat,"<%syslogpriority%>1 %TIMESTAMP:::date-rfc3339% %HOSTNAME% %app-name% %procid% - [TOKEN@XXX X-OVH-TOKEN=\"xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx\" priority=\"%syslogpriority-text%\" tag=\"%syslogtag%\" facility=\"%syslogfacility-text%\"] %msg%\n"
*.* @@laas.runabove.com:514;OVHFormat
# Uncomment line below for debug purpose
# *.* /var/log/ovh.log;OVHFormat
@miticojo
miticojo / galera.cnf
Created August 20, 2016 16:40
mariadb galera for openstack
# This file contains wsrep-related mysqld options. It should be included
# in the main MySQL configuration file.
#
# Options that need to be customized:
# - wsrep_provider
# - wsrep_cluster_address
# - wsrep_sst_auth
# The rest of defaults should work out of the box.
##

Keybase proof

I hereby claim:

  • I am miticojo on github.
  • I am miticojo (https://keybase.io/miticojo) on keybase.
  • I have a public key whose fingerprint is 0922 1955 A974 F3BC A7FF 2AD6 E083 34B4 A1F8 12FC

To claim this, I am signing this object:

@miticojo
miticojo / mitsubishi_ir_raw.cpp
Created August 29, 2016 21:37
c++ raw values for mitsubishi air conditioner devices
// Data collected thanks to project IRremoteESP8266
// project source: https://github.com/markszabo/IRremoteESP8266/blob/master/examples/IRrecvDumpV2/IRrecvDumpV2.ino
// hardware: esp8266 + ky-022
// Values are referred to Mitsubishi Electric air conditioner remote controller
// Power On
unsigned int power_on[99] = {3400,1700, 500,1250, 500,1250, 450,400, 500,400, 450,400, 500,1250, 500,400, 450,400, 500,1250, 450,1250, 500,400, 450,1250, 500,400, 450,400, 500,1250, 450,1250, 450,400, 450,1250, 500,1250, 500,400, 450,400, 450,1250, 500,400, 500,400, 450,1250, 500,400, 450,400, 500,400, 450,400, 500,400, 450,400, 450,400, 500,400, 450,400, 500,400, 450,400, 450,400, 450,450, 500,400, 500,400, 450,400, 500,400, 450,400, 500,400, 450,400, 450,1250, 450,450, 450,450, 450}; // PANASONIC C4D3:64800004
// Power Off
unsigned int power_off[99] = {3450,1700, 450,1250, 450,1250, 500,400, 500,400, 450,400, 450,1250, 500,400, 500,400, 500,1250, 450,1250, 450,400, 450,1250, 500,400, 450,400, 450,1250, 500,1250, 450,40
@miticojo
miticojo / syslog_rfc_regex.js
Created September 3, 2016 08:32
Regex for SYSLOG format RFC3164 and RFC5424
// RFC3164 https://www.ietf.org/rfc/rfc3164.txt (obsolete)
var regex_rfc3164 = /([A-Z][a-z][a-z]\s{1,2}\d{1,2}\s\d{2}[:]\d{2}[:]\d{2})\s([\w][\w\d\.@-]*)\s(.*)$/;
// RFC5424 https://www.ietf.org/rfc/rfc3164.txt
var regex_rfc5424 = /(?:(\d{4}[-]\d{2}[-]\d{2}[T]\d{2}[:]\d{2}[:]\d{2}(?:\.\d{1,6})?(?:[+-]\d{2}[:]\d{2}|Z)?)|-)\s(?:([\w][\w\d\.@-]*)|-)\s(.*)$/;
// valid string for regex test
var msg_rfc3164 = "<34>Oct 11 22:14:15 mymachine su: 'su root' failed for lonvick on /dev/pts/8";
var msg_rfc5424 = "<34>1 2003-10-11T22:14:15.003Z mymachine.example.com su - ID47 - BOM'su root' failed for lonvick on /dev/pts/8";
@miticojo
miticojo / cluster_cheet.md
Created September 9, 2016 13:39
Linux Cluster commands cheat sheet

Checking status of the cluster:

  • clustat
  • clustat -m -> Display status of and exit
  • clustat -s -> Display status of and exit
  • clustat -l -> Use long format for services
  • cman_tool status -> Show local record of cluster status
  • cman_tool nodes -> Show local record of cluster nodes
  • cman_tool nodes -af
  • ccs_tool lsnode -> List nodes
  • ccs_tool lsfence -> List fence devices
@miticojo
miticojo / example.ks
Created October 1, 2016 14:00
Kickstart Prompt for user input
......
%include /tmp/networkconfig
%pre --interpreter=busybox
exec < /dev/tty1 > /dev/tty1 2>&1
chvt 1
HOSTNAME=""
IPADDR=""
NETMASK=""