Skip to content

Instantly share code, notes, and snippets.

View AdSegura's full-sized avatar

Adolfo Segura AdSegura

View GitHub Profile
@AdSegura
AdSegura / radios.json
Last active June 6, 2025 15:02
Radios
{
"radioStations": [
{
"name": "RNE5 Todo Noticias",
"streamUrl": "https://rtvelivestream.rtve.es/rtvesec/rne/rne_r5_madrid_main.m3u8",
"iconUrl": "https://images.seeklogo.com/logo-png/11/1/rne-5-logo-png_seeklogo-118988.png",
"categoryId": 3,
"tags": [
"noticias"
],
@AdSegura
AdSegura / radio-fake1.json
Last active May 29, 2025 18:48
radio-fake1
{
"radioStations": [
{
"name": "RNE5 Todo Noticias",
"streamUrl": "https://rtvelivestream.rtve.es/rtvesec/rne/rne_r5_madrid_main.m3u8",
"iconUrl": "https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Radio_5_RNE_Spain.svg/330px-Radio_5_RNE_Spain.svg.png",
"categoryId": 3,
"tags": [
"noticias"
],
@AdSegura
AdSegura / radio-fake.json
Last active May 22, 2025 21:40
radio-fake
{
"stations": [
{
"id": 1,
"name": "RNE5 Todo Noticias",
"streamUrl": "https://rtvelivestream.rtve.es/rtvesec/rne/rne_r5_madrid_main.m3u8",
"iconUrl": "https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Radio_5_RNE_Spain.svg/330px-Radio_5_RNE_Spain.svg.png",
"iconType": "URL",
"categoryId": 3,
"tags": [
@AdSegura
AdSegura / xsearch.sh
Created May 28, 2021 22:16
create a keyboard shortcut to launch, firefox new tab, google search with clipboard content
#!/bin/bash
## create a keyboard shortcut [ctrl + up + q]
## to launch a search with clipboard content
QUERY=`xclip -o`
URL='https://www.google.com/search?&q='
URL+="$QUERY"
firefox --new-tab "$URL"
@AdSegura
AdSegura / wireguard_show.py
Last active September 20, 2025 15:14
wireguard show client list
#!/usr/bin/env python3
##
# Show wireguard statistics with usernames assigned to their public keys
# $> ./wg-show.py with no options will use
# wg0_file="/etc/wireguard/wg0.conf"
# wg_iface="wg0"
# sg_to_timeout=300 seconds
#
# ./wg-show.py --help
# usage: wg-show.py [-h] [--config CONFIG] [--interface INTERFACE]
// <p class="transform_date" data-date="2020-07-30 18:08:22"></p>
$(".transform_date").each(function() {
let created_at = $(this).data("date")
let ago = moment.tz(created_at, "YYYY-MM-DD HH:mm:ss", "UTC").fromNow();
$(this).html(ago)
});
@AdSegura
AdSegura / boss.js
Last active October 24, 2019 18:08
Nodejs workers as writeable stream
'use strict';
/**
* Nodejs Stream Workers example
* will cipher and return deciphered file.txt to console output
* using a worker as a writeable stream.
*
* Use:
* node boss.js < file.txt
*
* if node < 12
@AdSegura
AdSegura / makeBigFile.js
Created October 12, 2019 00:48
Backpressuring in NodeJs Streams
//Prerequisite: cli-progress ^3.0.0
const fs = require('fs');
const _cliProgress = require('cli-progress');
let script_mode = false;
/**
* Make a big file, or small...
*
* Cli:
* > node makeBigFile.js --dest '/tmp/foo.txt' --size 1gb
@AdSegura
AdSegura / AccessToken.php
Created August 3, 2019 13:53
Get AccessToken Bearer JWT Laravel Passport
// Code from https://github.com/laravel/passport/issues/779#issuecomment-429536388
<?php
namespace App;
use Laravel\Passport\Passport;
use Lcobucci\JWT\Builder;
use Lcobucci\JWT\Signer\Key;
use Lcobucci\JWT\Signer\Rsa\Sha256;
use League\OAuth2\Server\CryptKey;