Skip to content

Instantly share code, notes, and snippets.

View rafaelcalleja's full-sized avatar

Rafael Calleja rafaelcalleja

View GitHub Profile
@rafaelcalleja
rafaelcalleja / build.yml
Created July 27, 2022 10:27 — forked from alexanderbazo/build.yml
Github Actions: Build and Release Android-APK
name: Minimal Android CI Workflow
on:
push:
branches:
- master
tags:
- 'v*'
jobs:
@rafaelcalleja
rafaelcalleja / mysql_ip_address_info.sql
Created May 13, 2022 10:19 — forked from chris/mysql_ip_address_info.sql
Get list of IP addresses connected to MySQL DB, with their connection counts
SELECT
tmp.ipAddress,
-- Calculate how many connections are being held by this IP address.
COUNT( * ) AS numConnections,
-- For each connection, the TIME column represent how many SECONDS it has been in
-- its current state. Running some aggregates will give us a fuzzy picture of what
-- the connections from this IP address is doing.
FLOOR( AVG( tmp.time ) ) AS timeAVG,
@rafaelcalleja
rafaelcalleja / create-rabbitmq-exchange-queue-using-rest-api.sh
Created April 6, 2022 10:55 — forked from baybatu/create-rabbitmq-exchange-queue-using-rest-api.sh
Create RabbitMQ queue and exchange with binding using REST API
# create exchange
curl -i -u guest:guest -H "content-type:application/json" \
-XPUT -d'{"type":"fanout","durable":true}' \
http://localhost:15672/api/exchanges/%2f/my.exchange.name
# create queue
curl -i -u guest:guest -H "content-type:application/json" \
-XPUT -d'{"durable":true,"arguments":{"x-dead-letter-exchange":"", "x-dead-letter-routing-key": "my.queue.dead-letter"}}' \
http://localhost:15672/api/queues/%2f/my.queue
@rafaelcalleja
rafaelcalleja / functions.php
Created March 17, 2022 13:03 — forked from dhrrgn/functions.php
Slugify. Note: Requires PHP >= 5.4 and the Intl extension
<?php
function slugify($string, $toLower = true) {
$rules = "Any-Latin; Latin-ASCII; NFD; [:Nonspacing Mark:] Remove; NFC; [:Punctuation:] Remove;";
if ($toLower) {
$rules .= ' Lower();';
}
$string = transliterator_transliterate($rules, $string);
// Remove repeating hyphens and spaces (e.g. 'foo---bar' becomes 'foo-bar')
@rafaelcalleja
rafaelcalleja / Makefile.version
Created December 4, 2021 05:36 — forked from grihabor/Makefile.version
Makefile to use for incremental semantic versioning
MAKE := make --no-print-directory
DESCRIBE := $(shell git describe --match "v*" --always --tags)
DESCRIBE_PARTS := $(subst -, ,$(DESCRIBE))
VERSION_TAG := $(word 1,$(DESCRIBE_PARTS))
COMMITS_SINCE_TAG := $(word 2,$(DESCRIBE_PARTS))
VERSION := $(subst v,,$(VERSION_TAG))
VERSION_PARTS := $(subst ., ,$(VERSION))
@rafaelcalleja
rafaelcalleja / mitmproxy cheat sheet
Created March 11, 2021 11:29 — forked from 2bard/mitmproxy cheat sheet
mitmproxy cheat sheet
Movement:
j, k down, up
h, l left, right (in some contexts)
space page down
pg up/down page up/down
arrows up, down, left, right

Upgrade systemd on Ubuntu 18.04

In this document, I will explain how to upgrade the default systemd version from 237 to 242.

Install required dependencies

# Install required dependencies
sudo apt install build-essential devscripts python3-pip cmake libssl-dev libpcre2-dev
sudo apt purge meson -yq
@rafaelcalleja
rafaelcalleja / docker
Created January 27, 2021 09:31 — forked from piotrplenik/docker
Turn on Docker Remote API on Ubuntu (on port 2375)
# File: etc/default/docker
# Use DOCKER_OPTS to modify the daemon startup options.
#DOCKER_OPTS=""
DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4 -H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock"
@rafaelcalleja
rafaelcalleja / ansible_local_playbooks.md
Created November 6, 2020 20:20 — forked from alces/ansible_local_playbooks.md
How to run an Ansible playbook locally
  • using Ansible command line:
ansible-playbook --connection=local 127.0.0.1 playbook.yml
  • using inventory:
127.0.0.1 ansible_connection=local