Skip to content

Instantly share code, notes, and snippets.

View skarllot's full-sized avatar
💭
I may be slow to respond.

Fabrício Godoy skarllot

💭
I may be slow to respond.
View GitHub Profile
@skarllot
skarllot / test-rdtsc.c
Last active August 29, 2015 14:15
Test time stamp counter
// http://security.stackexchange.com/a/34552
#include <stdio.h>
#if defined(__i386__)
static __inline__ unsigned long long rdtsc(void)
{
unsigned long long int x;
__asm__ __volatile__ (".byte 0x0f, 0x31" : "=A" (x));
@skarllot
skarllot / wbfix.sql
Created February 11, 2015 12:55
Fix Bareos Media table to use with Webacula
use bareos;
ALTER TABLE Media ADD COLUMN VolParts INTEGER UNSIGNED NOT NULL DEFAULT 0;
@skarllot
skarllot / page.conf
Created January 17, 2015 07:11
Apache config to Passenger (Redmine)
<IfModule passenger_module>
<VirtualHost *:80>
ServerAdmin admin@example.com
ServerName page.example.com
DocumentRoot "/var/www/redmine/public"
PassengerAppRoot /var/www/redmine
RailsEnv 'production'
@skarllot
skarllot / mail_alert.py
Last active August 29, 2015 14:13
Zabbix script to custom e-mail messaging (email)
#!/usr/bin/python
import sys
import re
import subprocess
from zabbix_auth import *
server = 'smtp.example.com'
user = 'user1@example.com'
password = 'AnyP@ssw0rd'
@skarllot
skarllot / cluster.xml
Last active August 29, 2015 14:11
Pacemaker examples (drbd, gfs2, heartbeat, stonith, vmware)
<!-- /etc/cluster/cluster.conf -->
<?xml version="1.0"?>
<cluster config_version="23" name="pm_cluster01">
<clusternodes>
<clusternode name="node01" nodeid="1">
<fence>
<method name="pcmk-redirect">
<device name="pcmk" port="node01"/>
</method>
</fence>
@skarllot
skarllot / intersection-group.ps1
Created December 10, 2014 17:57
PowerShell script to populate groups that its members is a intersection between other groups
Import-Module ActiveDirectory
Function Refresh_Group ($groupname, $newmembers)
{
$oldmembers = Get-ADGroupMember -Identity $groupname
$rmmembers = $null
$addmembers = $null
if ($oldmembers -eq $null -and $newmembers -eq $null) {
return
@skarllot
skarllot / removeupdates.cmd
Created October 31, 2014 01:36
Uninstall a set of Windows updates that were installed on a specific date
@echo off
if "x%~1%x" EQU "xx" GOTO USAGE
set date=%1
setlocal EnableDelayedExpansion
echo Composing the list of updates to remove ...
@skarllot
skarllot / xenconvert.sh
Last active September 12, 2017 12:09
Migrate XenServer format (.XVA) to Open Source Xen (.IMG)
#!/bin/bash
dd if=/dev/zero of=blank bs=1024 count=1k
test -f $1.img && rm -f $1.img
touch $1.img
max=`ls ???????? | sort | tail -n1`
for i in `seq 0 $max`; do
fn=`printf "%08d" $i`
@skarllot
skarllot / mysql-check.sh
Last active February 22, 2018 20:56
Bash script to check MySQL database for errors (tables check)
#!/bin/bash
#
# #automysqlcheck.sh
#
# This is a small bash script that checks all mysql databases for errors
# and mails a log file to a specified email address. All variables are
# hardcoded for ease of use with cron. Any databases you wish not to check
# should be added to the DBEXCLUDE list, with a space in between each name.
#
# original version by sbray@csc.uvic.ca, UVic Fine Arts 2004
# This command scan new hard disk drives on Linux Systems.
# this is useful when the host is on a Virtual Environment and you add new hard disks to it
ls /sys/class/scsi_host/ | while read host ; do echo "- - -" > /sys/class/scsi_host/$host/scan ; done