Skip to content

Instantly share code, notes, and snippets.

View pedroamador's full-sized avatar
💭
Happy

Pedro Amador Rodríguez pedroamador

💭
Happy
View GitHub Profile
@pedroamador
pedroamador / fix_amazon_root_access.sh
Created July 10, 2014 07:54
This is a script to allow root access to amazon instances (ubuntu / debuian)
#!/bin/bash
sudo perl -i -pe 's/disable_root: 1/disable_root: 0/' /etc/cloud/cloud.cfg
sudo perl -i -pe 's/#PermitRootLogin .*/PermitRootLogin without-password/' /etc/ssh/sshd_config
sudo perl -i -pe 's/.*(ssh-rsa .*)/\1/' /root/.ssh/authorized_keys
sudo /etc/init.d/ssh reload # optional command
@pedroamador
pedroamador / VagrantBoxCleanerDebian
Last active October 4, 2016 13:47 — forked from bkuberek/gist:5266195
Vagrant BOX cleaner for Debian / Ubuntu
apt-get -y autoremove
apt-get clean
# Zero out the free space to save space in the final image:
dd if=/dev/zero of=/EMPTY bs=1M
rm -f /EMPTY
# Removing leftover leases and persistent rules
echo "cleaning up dhcp leases"
rm /var/lib/dhcp/*

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@pedroamador
pedroamador / VagrantBOXCleanerCentos
Created December 16, 2014 06:42
Vagrant BOX Cleaner Centos
# Clear yum packages
yum clean all
# Zero out the free space to save space in the final image:
dd if=/dev/zero of=/EMPTY bs=1M
rm -f /EMPTY
# Removing leftover leases and persistent rules
echo "cleaning up dhcp leases"
rm -f /var/lib/dhclient/*
@pedroamador
pedroamador / first-sunday-of-month.sh
Last active August 29, 2015 14:13
Get day number of first sunday on actual month in linux
#!/bin/bash
# Print day number of the first sunday of the month
cal | awk 'NF==7&&NR>2{print $1;exit}'
#!/bin/sh
service rsyslog stop
sed -i -e 's/^\$ModLoad imklog/#\$ModLoad imklog/g' /etc/rsyslog.conf
service rsyslog start
@pedroamador
pedroamador / git-promote
Last active January 30, 2017 11:47 — forked from neg3ntropy/git-promote
Promote an "upstream" Git branch by merging it into a "downstream" branch.
#!/bin/bash
# POSIX
# Credits
# - Forked from soulrebel git-promote gist https://gist.github.com/soulrebel/9c47ee936cfce9dcb725
# - Parse arguments howto http://mywiki.wooledge.org/BashFAQ/035
git_promote="$(basename "$0" | sed -e 's/-/ /')"
HELP="Usage: $git_promote [options...] [upstream] <downstream>
@pedroamador
pedroamador / Jenkinsfile
Created February 19, 2017 09:42 — forked from amaksoft/Jenkinsfile
My example Jenkins Pipeline setup for Android app project
#!/usr/bin/groovy
/*
* Copyright (c) 2016, Andrey Makeev <amaksoft@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
@pedroamador
pedroamador / global_git_hook_commit_validation.md
Last active October 26, 2018 18:53
Add "eslint" commit validation hook
@pedroamador
pedroamador / github-merge.sh
Created November 4, 2017 12:30
Script to merge github pull requests remotely, while inspecting & signing them.
#!/bin/bash
# This script will locally construct a merge commit for a pull request on a
# github repository, inspect it, sign it and optionally push it.
# The following temporary branches are created/overwritten and deleted:
# * pull/$PULL/base (the current master we're merging onto)
# * pull/$PULL/head (the current state of the remote pull request)
# * pull/$PULL/merge (github's merge)
# * pull/$PULL/local-merge (our merge)