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 / rancher-zerotier.yml
Last active April 27, 2018 16:50 — forked from elcritch/rancher-zerotier.yml
Run ZeroTier on RancherOS
# zerotier configuration
zerotier:
image: zerotier/zerotier-containerized:1.2.4
labels:
io.rancher.os.scope: system
volumes:
- /var/lib/zerotier-one:/var/lib/zerotier-one
restart: always
net: host
devices:
@pedroamador
pedroamador / Jenkinsfile
Created January 3, 2018 10:21 — forked from bvis/Jenkinsfile
Jenkin pipeline definition example to be integrated with Docker Swarm cluster in our CI/CD environment
pipeline {
agent { node { label 'swarm-ci' } }
environment {
TEST_PREFIX = "test-IMAGE"
TEST_IMAGE = "${env.TEST_PREFIX}:${env.BUILD_NUMBER}"
TEST_CONTAINER = "${env.TEST_PREFIX}-${env.BUILD_NUMBER}"
REGISTRY_ADDRESS = "my.registry.address.com"
SLACK_CHANNEL = "#deployment-notifications"
@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)
@pedroamador
pedroamador / global_git_hook_commit_validation.md
Last active October 26, 2018 18:53
Add "eslint" commit validation hook
@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 / 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>
#!/bin/sh
service rsyslog stop
sed -i -e 's/^\$ModLoad imklog/#\$ModLoad imklog/g' /etc/rsyslog.conf
service rsyslog start
@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}'
@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/*

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