Skip to content

Instantly share code, notes, and snippets.

View vicendominguez's full-sized avatar

Vicen Domínguez vicendominguez

View GitHub Profile
@vicendominguez
vicendominguez / nagioscsv2hosts.pl
Last active January 14, 2021 11:46
Converting: nagios 3.0 host cfg to csv <-> csv to nagios 3.0 host cfg
#!/usr/bin/perl
##################
## CSV Format ##
## Delimiter ; ##
##################
######################################################
### ###
### name;ip_contador ###
### ###
######################################################
@vicendominguez
vicendominguez / dumpxlsx.pl
Created February 5, 2014 09:42
Dump a excel file (xlsx) to terminal (grep after to search words)
#!/usr/bin/env perl
# with a "grep" in terminal you can search words in a excel
use strict;
use warnings;
use Text::Iconv;
my $converter = Text::Iconv -> new ("utf-8", "windows-1251");
# Text::Iconv is not really required.
# This can be any object with the convert method. Or nothing.
@vicendominguez
vicendominguez / numcpu.c
Created February 5, 2014 09:49
Discovering the real number of CPUs in the host server from inside of a VZ container
/* numcpu.c code is a part of FFMPEG source (libavutil/) ;)
You can play with the definitions in compilation time. Very interesting.
[root@host:~# grep -c processor /proc/cpuinfo
24
[root@build /]# grep -c processor /proc/cpuinfo
1
We have one openvz container with 1 CPU in one server with 24 cpus (cores: 2x cpu 6xcore 2x ht):
@vicendominguez
vicendominguez / gnuradio_install.sh
Created February 5, 2014 09:50
gnuradio in MacOS X (installation line) for SDR etc etc.....
# You need macports installed.
# This is the magic command line:
port install gnuradio +full configure.compiler=gcc
@vicendominguez
vicendominguez / dokuwiki.conf
Created February 5, 2014 09:51
Dokuwiki + Nginx config file (CentOS 6.4)
server {
server_name dokuwiki.domain.com;
root /var/www/dokuwiki;
location / {
index doku.php;
try_files $uri $uri/ @dokuwiki;
}
location ^~ /conf/ { return 403; }
@vicendominguez
vicendominguez / gist:8820342
Created February 5, 2014 09:53
massive-kill for mysql sleep connections (concept)
#This is a bullshit but... i will kill all the sleep connections which sleeping time starting with 8
for a in `echo "show processlist" |mysql --user=root --password=tete coredb |egrep 'Sleep[[:space:]]+8[[:digit:]]+' |awk '{ print $1 }'`; do echo "KILL $a" | mysql --user=root --password=tete coredb; done
@vicendominguez
vicendominguez / macosx
Last active August 29, 2015 13:56
Compiling a .cpp source with OpenCV libs in MacOSX/Ubuntu 13.04
# MacOS X 10.7.x
# You need opencv is installed (macports)
g++ -ggdb `pkg-config --cflags opencv` `pkg-config --libs opencv` header.cpp header2.cpp program.cpp -o program
@vicendominguez
vicendominguez / vmsqlstat.sh
Last active August 29, 2015 13:56
watching queries per second (vmstat style) on MySQL
mysqladmin ext -ri 1 |grep -i -e queries -e \-
@vicendominguez
vicendominguez / demo.spec
Created February 5, 2014 09:59
Basic Demo SPEC file
Name: demoproject
Version: 0.1
Release: 1%{?dist}
Summary: Demo script for doing something cool
Group: DemoGroup
License: GPL
Source0: demoproject-0.1.tar.gz
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
@vicendominguez
vicendominguez / gist:8820582
Created February 5, 2014 10:11
MINT 13 AND UBUNTU 12.04 CANON IR C2880-C3380 (UFR2) HOW TO
MINT 13 AND UBUNTU 12.04 CANON IR C2880-C3380 (UFR2) HOW TO
--------------------------------------------------------------
Download drivers for Linux from Canon
unzip Linux_UFRII_PrinterDriver_V250_uk_EN.tar.gz
cd Linux_UFRII_PrinterDriver_V250_uk_EN/64-bit_Driver/RPM/
alien --to-deb --scripts cndrvcups-common-2.50-1.x86_64.rpm
alien --to-deb --scripts cndrvcups-ufr2-uk-2.50-1.x86_64.rpm
apt-get install libc6-i386 ia32-libs lib32z1
dpkg -i cndrvcups-common_2.50-2_amd64.deb cndrvcups-ufr2-uk_2.50-2_amd64.deb