Skip to content

Instantly share code, notes, and snippets.

View pserrano's full-sized avatar

Pablo Serrano pserrano

View GitHub Profile
@pserrano
pserrano / keybase.md
Created June 4, 2019 15:51
keybase.md

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@pserrano
pserrano / server.json
Created November 14, 2018 06:03
Packer with ansible solution for AWS
"variables": {
"profile": "aws1",
"region": "eu-east-1",
"type":"amazon-ebs",
"ssh_keypair_name": "private",
"ssh_private_key_file": "$HOME/.ssh/private.pem"
},
"provisioners": [
{
@pserrano
pserrano / hosts_ansible_vagrant
Last active January 15, 2018 09:43
Ssh into a vagrant machine with ansible
#search ssh file key of machine with 'vagrant ssh-config | grep IdentityFile'
192.168.50.5 ansible_ssh_port=22 ansible_ssh_user=vagrant ansible_ssh_private_key_file=~/.ssh/id_rsa
@pserrano
pserrano / gist:99968d26eed4a492d1c0e3cd40be3c0b
Last active September 22, 2017 11:02
kubernetes fix user home
#To start using your cluster, you need to run (as a regular user):
sudo cp /etc/kubernetes/admin.conf $HOME/
sudo chown $(id -u):$(id -g) $HOME/admin.conf
export KUBECONFIG=$HOME/admin.conf
@pserrano
pserrano / gitreset
Created September 14, 2017 09:34
Remove commit and revert
git reset --hard <commit-hash>
git push -f origin master
@pserrano
pserrano / gitsuperpull.sh
Last active August 28, 2017 09:40
Gitsuperpull
#!/bin/bash
DIRS=($(ls -d */))
PWD=($(pwd))
GIT="/.git/"
for i in "${DIRS[@]}"; do
if [[ "$i" == "parameters/" ]] || [[ "$i" == "jenkinsfile/" ]]; then
cd $i; PARA=($(ls -d */));
echo $i
for j in "${PARA[@]}"; do
echo $j
@pserrano
pserrano / php_append.php
Created September 9, 2016 06:25
php_append.php auto_append_file fpm memory check process
#Memory check process for fpm
<?php
$logline = sprintf(date("Y-m-d H:i:s") . "\t" . round(memory_get_peak_usage() / 1024 / 1024,2) . " MB\t" . $_SERVER["REQUEST_URI"] . "\n");
file_put_contents("/var/log/nginx/fpm_memory.log", $logline, FILE_APPEND | LOCK_EX);
@pserrano
pserrano / yosemite ntfs read+write.txt
Last active October 17, 2015 14:05 — forked from bjorgvino/yosemite ntfs read+write.txt
osxfuse + ntfs-3g + Yosemite = NTFS R/W
Remove osxfuse if installed via homebrew:
> brew uninstall osxfuse
Install osxfuse binary and choose to install the MacFUSE compatibility layer:
http://sourceforge.net/projects/osxfuse/files/latest/download?source=files
Reboot (optional but recommended by osxfuse)
Install ntfs-3g via homebrew:
> brew update && brew install ntfs-3g
LINT_IGNORES = ['rvm']
namespace :lint do
desc "Check puppet module code style."
task :ci do
begin
require 'puppet-lint'
rescue LoadError
fail 'Cannot load puppet-lint, did you install it?'
end
@pserrano
pserrano / backup.php
Last active August 29, 2015 14:07 — forked from Serhioromano/backup.php
Backup EC2 EBS automatic snapshot for all volumes if you want backup for all.
#!/usr/bin/php -q
<?php
date_default_timezone_set('UCT');
$dryrun = FALSE;
$interval = '24 hours';
$keep_for = '10 Days';
$volumes = array('vol-********');
$api_key = 'AKIAIXXXXXXXXXXXXXXX';
$api_secret = 'IzMni.........................emQKct';