Skip to content

Instantly share code, notes, and snippets.

Isaac isalgueiro

Block or report user

Report or block isalgueiro

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@isalgueiro
isalgueiro / update-alternatives-for-manually-installed-jdk.sh
Created May 15, 2018
This script update all Java related alternatives to point a manually installed JDK.
View update-alternatives-for-manually-installed-jdk.sh
#!/bin/bash
# Run update-alternatives for a manual installed JDK
JAVA_HOME=/opt/java/jdk1.8.0_152
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
isalgueiro / updateAWSecurityGroup.bash
Last active Aug 27, 2019 — 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 myip.opendns.com @resolver1.opendns.com`
securityGroupIds="sg-stuffstuff"
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
isalgueiro / kubuntu-to-neon.md
Last active Apr 8, 2018 — forked from nihathrael/kubuntu-to-neon.md
How to upgrade kubuntu 16.04 -> KDE neon
View kubuntu-to-neon.md

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
isalgueiro / golang and angular development environment.md
Created Feb 7, 2018
setup a development environment with hot reloading code changes
View golang and angular development environment.md

This is useful for environments where the angular app is served directly from golang. For example, using github.com/julienschmidt/httprouter 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
isalgueiro / logstash_geoip.conf
Last active Nov 30, 2017
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
isalgueiro / parallel_http.R
Created Nov 29, 2017
HOW-TO get parallel HTTP connections in R
View parallel_http.R
library(parallel)
library(httr)
library(RCurl)
detectCores()
f <- function(x) {
#h <- httr::handle('http://slowwly.robertomurray.co.uk/')
#httr::GET('http://slowwly.robertomurray.co.uk/delay/2000/url/http://www.google.co.uk', handle = h)
RCurl::httpGET('http://slowwly.robertomurray.co.uk/delay/2000/url/http://www.google.co.uk')
#Sys.sleep(2)
return(T)
@isalgueiro
isalgueiro / jira-get_worklog.php
Created Nov 7, 2017
How to get list of worklogs through JIRA REST API
View jira-get_worklog.php
<?php
// https://community.atlassian.com/t5/Answers-Developer-Questions/How-to-get-list-of-worklogs-through-JIRA-REST-API/qaq-p/533633
$server = 'jira.example.com';
$fromDate = '2017-11-07';
$toDate = '2012-11-08';
$project = 'X';
$assignee = 'bob';
$username = 'username';
$password = 'password';
@isalgueiro
isalgueiro / 2utf8.sh
Created Nov 6, 2017
Convert all ISO-8859 files to UTF-8
View 2utf8.sh
#!/bin/bash
# Convert all ISO-8859 files in $1 directory to UTF-8
error_check() {
res=$1
if [ $res -ne 0 ]; then
echo ""
echo "error $res"
exit $res
View .bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@isalgueiro
isalgueiro / _run_metricbeat_with_old_kernels.md
Last active Mar 16, 2018
Run metricbeat with old kernels where original init.d script fails with `kernel too old` message
View _run_metricbeat_with_old_kernels.md

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/metricbeat.pid -- /usr/share/metricbeat/bin/metricbeat -c /etc/metricbeat/metricbeat.yml -path.home /usr/share/metricbeat -path.config /etc/metricbeat -path.data /var/lib/metricbeat -path.logs /var/log/metricbeat
                                                           [FAILED]

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.

You can’t perform that action at this time.