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
@jparrill
jparrill / Vagrantfile
Last active December 30, 2019 01:56
Vagrantfile for storage creation
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Dummy Vagrantfile
VAGRANTFILE_API_VERSION = "2"
BOX_MEM = ENV['BOX_MEM'] || "1024"
BOX_CORE = ENV['BOX_CORE'] || "1"
BOX_NAME = ENV['BOX_NAME'] || "nrel/CentOS-6.5-x86_64"
@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 / 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
@jparrill
jparrill / dyn-json-inv.py
Last active November 16, 2018 15:29
API Mocked for Dyn Inventory Generation
#!/usr/bin/python
import json
import requests
import argparse
import ConfigParser
import random
import re
from os.path import realpath
from os.path import dirname
import os
@jparrill
jparrill / keybase.md
Created December 5, 2017 10:20
Keybase

Keybase proof

I hereby claim:

  • I am jparrill on github.
  • I am jparrill (https://keybase.io/jparrill) on keybase.
  • I have a public key ASCuZVyXe9DoLM0X3VeOijrpXTFShgbesaAMHoiXFcY8EQo

To claim this, I am signing this object:

@jparrill
jparrill / blurlock.sh
Created February 14, 2018 09:51
i3 Config + Scripts
#!/bin/bash
import -window root /tmp/screenshot.png
convert /tmp/screenshot.png -spread 6 /tmp/screenshotblur.png
rm /tmp/screenshot.png
i3lock -i /tmp/screenshotblur.png
@jparrill
jparrill / full_mongodb_apb_log
Created March 9, 2018 16:15
MongoDB-APB Log Execution
➜ mongodb-apb git:(master) oc logs -f apb-run-provision-mongodb-apb6ncsp -n mongodb-01
+ [[ provision --extra-vars {"MONGODB_ADMIN_PASSWORD": "admin", "MONGODB_DATA_STORAGE_SIZE": 1, "MONGODB_VERSION": "3.4", "MONGODB_MEMORY_LIMIT": "512Mi", "_apb_plan_id": "ephemeral", "namespace": "mongodb-01", "MONGODB_PASSWORD": "password", "MONGODB_USER": "username", "MONGODB_IMAGE_TAG": "latest", "MONGODB_DATABASE": "sampledb", "USE_UPSTREAM_IMAGES": false} == *\s\2\i\/\a\s\s\e\m\b\l\e* ]]
+ ACTION=provision
+ shift
+ playbooks=/opt/apb/actions
+ CREDS=/var/tmp/bind-creds
+ TEST_RESULT=/var/tmp/test-result
+ whoami
+ '[' -w /etc/passwd ']'
++ id -u