Skip to content

Instantly share code, notes, and snippets.

isalgueiro /
Created May 15, 2018 10:42
This script update all Java related alternatives to point a manually installed JDK.
# Run update-alternatives for a manual installed JDK
java_bins=(appletviewer extcheck idlj jarsigner java javac javadoc javafxpackager javah javap javapackager java-rmi.cgi javaws jcmd jconsole jcontrol jdb jdeps jhat jinfo jjs jmap jps jrunscript jsadebugd jstat jstatd jvisualvm keytool native2ascii orbd pack200 policytool rmic rmid schemagen servertool tnameserv wsgen wsimport xjc jar jmc jmc.ini jstack rmiregistry serialver unpack200)
for java_bin in ${java_bins[@]}; do
echo "Setting $java_bin..."
update-alternatives --install /usr/bin/$java_bin $java_bin $JAVA_HOME/bin/$java_bin 1
isalgueiro / updateAWSecurityGroup.bash
Last active December 15, 2020 16:17 — forked from antonmry/updateAWSecurityGroup.bash
Simple bash script to update a Security Group matched by description and port in AWS with your Public IP
View updateAWSecurityGroup.bash
#! /bin/bash
publicIP=`dig +short`
ruleDescription="This is the string we're using to find our rule"
## Consult previous one
awsOutput=`aws ec2 describe-security-groups --group-ids $securityGroupIds`
ipRangeIndex=`echo $awsOutput | gron | grep $ruleDescription | sed "s/.\+IpRanges\[\([0-9]\+\)\].\+/\1/"`
isalgueiro /
Last active April 8, 2018 21:31 — forked from nihathrael/
How to upgrade kubuntu 16.04 -> KDE neon

This worked for me and might not work for you. It's a seriuos change to your system, you need to be familiar with apt and with fixing missing or invalid dependencies.

Try it at your own risk!

Uninstall any KDE or Plasma related package

apt purge kubuntu-desktop plasma-desktop kde-baseapps kde-runtime kubuntu-driver-manager
apt autoremove
isalgueiro / golang and angular development
Created February 7, 2018 10:53
setup a development environment with hot reloading code changes
View golang and angular development

This is useful for environments where the angular app is served directly from golang. For example, using and having angular build in frontend/dist directory

	router := httprouter.New()
// All your router config here [...]
	router.NotFound = http.FileServer(http.Dir("./frontend/dist"))
	router.RedirectFixedPath = false
	router.RedirectTrailingSlash = false
  http.ListenAndServe(":8080", router)
isalgueiro / logstash_geoip.conf
Last active November 30, 2017 09:53
Adding geoip info in logstash is not an straightforward configuration. You need to adapt `location` field to visualize it properly in Kibana (i.e. use it in a map view).
View logstash_geoip.conf
if [remote_host] =~ /.+/ {
geoip {
source => "remote_host"
if "_geoip_lookup_failure" not in [tags] {
mutate {
remove_field => ["[geoip][location]"] # para que non mande un array
mutate {
convert => {"[geoip][latitude]" => "float"}
isalgueiro / parallel_http.R
Created November 29, 2017 13:06
HOW-TO get parallel HTTP connections in R
View parallel_http.R
f <- function(x) {
#h <- httr::handle('')
#httr::GET('', handle = h)
isalgueiro / jira-get_worklog.php
Created November 7, 2017 17:34
How to get list of worklogs through JIRA REST API
View jira-get_worklog.php
$server = '';
$fromDate = '2017-11-07';
$toDate = '2012-11-08';
$project = 'X';
$assignee = 'bob';
$username = 'username';
$password = 'password';
isalgueiro /
Created November 6, 2017 16:06
Convert all ISO-8859 files to UTF-8
# Convert all ISO-8859 files in $1 directory to UTF-8
error_check() {
if [ $res -ne 0 ]; then
echo ""
echo "error $res"
exit $res
isalgueiro /
Last active March 16, 2018 09:24
Run metricbeat with old kernels where original init.d script fails with `kernel too old` message

In old kernels (~2.6.20) beats fail to start with a message like this:

FATAL: kernel too old
/bin/bash: line 1:  5496 Segmentation fault      /usr/share/metricbeat/bin/metricbeat-god -r / -n -p /var/run/ -- /usr/share/metricbeat/bin/metricbeat -c /etc/metricbeat/metricbeat.yml -path.home /usr/share/metricbeat -path.config /etc/metricbeat /var/lib/metricbeat -path.logs /var/log/metricbeat

You can replace original /etc/init.d/metricbeat file with this script to run metricbeat in old Red Hat systems. After replacing the file run checkconfig --add metricbeat so metricbeat starts automatically with every system start.

isalgueiro / docker-compose.yml
Created July 18, 2017 12:03
Docker compose for wordpress
View docker-compose.yml
version: '3.1'
image: mysql:5.7
- mywebdb_data:/var/lib/mysql
MYSQL_ROOT_PASSWORD: supersecretpassword