Skip to content

Instantly share code, notes, and snippets.

# global_conf.json for https://github.com/hallard/single_chan_pkt_fwd.git
{
"SX127x_conf":
{
"freq": 868100000,
"spread_factor": 7,
"pin_nss": 6,
"pin_dio0": 7,
"pin_rst": 0
},
@bmiro
bmiro / wp-logo-title-aling.css
Last active December 27, 2018 11:28
WordPress align logo and site title (all medias)
/* Title color */
.site-header .site-branding .site-title a {
color: #7dae33ff;
}
/* Align logo and title for al devices */
@media (min-width:769px) {
.site-branding {
display: inline-block;
/* Adjunst depending text lenght */
@bmiro
bmiro / cache-killer.lua
Created May 7, 2018 14:37
Lua snippet for wrk to skip caches by adding a querystring
-- Lua snippet to use with wrk to test (stress / benchmark) urls skipping CDN / Framework / misc
-- cache by adding a 'random' querystring
--
-- To use it adjust wrk params and do something like this:
-- docker run --rm -v $(pwd)/cache-killer.lua:/cache-killer.lua skandyla/wrk -c 1 -d 1 -t 1 --script /cache-killer.lua http://www.yoursite/testpath
request = function()
path = wrk.path
if path.find(path, "?") then
path = path .. "&"
@bmiro
bmiro / jsondiff
Last active June 22, 2021 08:57
JSON diff tool for cli (jsondiff) using `jq` with able to show it on vim with `--vim`
#!/bin/bash
DIFF_PARAMS="-aur --color=auto"
# Precondition check
which jq > /dev/null || (echo "jq is required" && exit 1)
# Arg check
for arg in "$@"; do
shift
@bmiro
bmiro / gist:370a159e9d2315c65fa8c8c1038bf4ef
Created December 21, 2017 23:06
Timing escrutini 21D
21:00 1,77%
21:03 2,25%
21:06 2,89%
21:09 3,48%
21:12 4,18%
21:15 5,21%
21:18 6,38%
21:21 7,77%
21:24 9,54%
21:27 11,74%
#!/bin/bash
url="https://resultats.parlament2017.cat/09AU/DAU09999CM.htm"
last=""
while true
do
hour=$(curl -s "$url?$RANDOM" | \
grep '="hora"> .* <\/span>' | \
@bmiro
bmiro / signal_example.py
Created October 10, 2017 12:55
Python signal example for Ctrl+C
import signal
import sys
from time import sleep
def sig_h(signal, frame):
global n
print("Signal! n: {}".format(n))
signal.signal(signal.SIGINT, sig_h)
@bmiro
bmiro / binloganal
Created June 2, 2017 12:38
Simple binlog analyzer (usage per DB and table) `mysqlbinlog mysql-bin.* | binloganal`
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import locale
import codecs
import operator
import sys
from re import match
from pprint import pprint
@bmiro
bmiro / ecsdn
Created May 3, 2017 10:36
Amazon ECS taskArn and container name to docker name (run inside instance running docker)
#!/usr/bin/env python3
from sys import exit
import click
from requests import get
###############################
# Amazon Linux:
# yum install python-35
# Mikrotik script to update DuckDNS.org domain, to use it:
# - Download it as `duckdns-update`
# - Tune your `duckToken` and `duckDomain` variables
# - Copy it to your router:
# `scp duckdns-update user@you-router:`
# - Add the script
# `/system script add name=duckdns-update source=[ /file get duckdns-update contents ]`
# - Add a periodic task to execute it
# `/system scheduler add name=duckdns-updater interval=1h on-event=duckdns-update`
# - Or execute it manully