Skip to content

Instantly share code, notes, and snippets.

View jparrill's full-sized avatar
🏡
Working from Home!

Juan Manuel Parrilla Madrid jparrill

🏡
Working from Home!
View GitHub Profile

Keybase proof

I hereby claim:

  • I am padajuan on github.
  • I am padajuan (https://keybase.io/padajuan) on keybase.
  • I have a public key whose fingerprint is B885 F4D7 AAB1 6EE6 0871 0776 6557 3E3C C23D C3D9

To claim this, I am signing this object:

@jparrill
jparrill / Xvfb.sh
Created May 12, 2014 07:22
Init Script for Xvfb
#!/bin/bash
#
# /etc/rc.d/init.d/xvfb
#
# chkconfig: 345 95 28
# description: Starts/Stops X Virtual Framebuffer server
# processname: Xvfb
#
. /etc/init.d/functions
@jparrill
jparrill / stress.py
Created May 11, 2015 14:48
Stress python script
from multiprocessing import Pool
def f(x):
# Put any cpu (only) consuming operation here. I have given 1 below -
while True:
x * x
# decide how many cpus you need to load with.
no_of_cpu_to_be_consumed = 1
@jparrill
jparrill / rhel_6_workshop.sh
Last active August 29, 2015 14:21
Shell script for RHEL 6 workshop
#!/bin/bash
#
# backup Startup script for the workshop
#
# chkconfig: 24 86 15
# description: awakes a workshop script
# processname: backup
#
### BEGIN INIT INFO
# Provides: backup
@jparrill
jparrill / copy_config_files.rb
Last active August 29, 2015 14:28
A custom Puppet function to create a copy of files in a path without desired extension. Path=./<module>/lib/puppet/parser/functions/copy_config_files.rb.
require 'find'
require 'fileutils'
module Puppet::Parser::Functions
newfunction(:copy_config_files) do |args|
function_notice(["Using copy_config_files script..."])
## Get all files with extension as follows
config_files = []
Find.find(args[1]) do |path|
config_files << path if path =~ /.*\.template$/
@jparrill
jparrill / Crontab_ eraser.sh
Last active December 14, 2015 13:58
Crontab eraser for automatic remove of crontab entries.
#!/bin/bash
#
#########################################
##Autor: Juan Manuel Parrilla
##Descr: This script will remove a especific crontab entry from /etc/crontab file
#########################################
##
## THIS SCRIPT NEED SUDO PERMS TO MODIFY CRONTAB FILE
## How to use:
## $1 --> Pattern to find crontab entry (EG) Script name or something
@jparrill
jparrill / lxpanel
Last active December 17, 2015 00:58
Script to handle the panels hung in LXDE
#!/bin/bash
######
## OS: Mint 12 / Debian
## Service: LXDE
## Desc: This script stop and start the lxde panel if it is hang
## Auth: Juan Manuel Parrilla
######
INSTANCE=/usr/bin/lxpanel
PROFILE=`ps aux | grep $INSTANCE | grep -v grep | awk '{print $13}'`
@jparrill
jparrill / SoapUI_test_detector.groovy
Created July 9, 2013 10:23
SoapUI Test failed detector in groovy for Jenkins
pattern = /.*Total TestCases: ([0-9]) \(([0-9]) failed\)*./
matcher = manager.getLogMatcher(pattern)
if(matcher?.matches()) {
total = matcher.group(1).toInteger()
fails = matcher.group(2).toInteger()
}
manager.listener.logger.println total
manager.listener.logger.println fails
@jparrill
jparrill / mongos
Created November 28, 2013 12:11
Mongos script file for RedHat/CentOS, if you change a few this script you can adapt for your needs
#!/bin/bash
# mongos - Startup script for mongos
# chkconfig: 35 85 15
# description: Mongo Router Process for sharding
# processname: mongos
# config: /etc/mongo/mongos.conf
# pidfile: /var/run/mongo/mongos.pid
@jparrill
jparrill / README.md
Created December 20, 2016 10:33
Mapping key-value from ini file based on a pattern into a hash

Copy the Ini file into your home folder and execute this from CLI

Input:

ansible-playbook -i inv mapper.yml -v --extra-vars "pattern=port"

Output:

Using /etc/ansible/ansible.cfg as config file