Skip to content

Instantly share code, notes, and snippets.

View megadix's full-sized avatar

Dimitri De Franciscis megadix

View GitHub Profile
@megadix
megadix / playWebRadio.ps1
Created October 30, 2025 09:16
Searches for web radio stations by genre using the Radio Browser API and plays them on VLC
<#
.SYNOPSIS
Searches for and plays web radio stations by genre using the Radio Browser API.
.DESCRIPTION
The playWebRadio function searches the Radio Browser API (radio-browser.info) for radio stations
matching a specified genre/style and plays a random working station using VLC media player.
The function performs the following operations:
- Searches the Radio Browser API for stations matching the specified genre tag
@megadix
megadix / jfif_to_jpg.py
Created May 17, 2024 06:33
Python script to convert JFIF images to JPEG - useful for images generated by Image Creator from Microsoft Bing
# Prerequisites:
# 1. Python 3.x
# 2. Pillow library (PIL fork)
# pip install pillow
import os
import sys
from PIL import Image
dir_path = None
@megadix
megadix / vpn-heartbeat.ps1
Last active January 17, 2024 15:51
VPN Heartbeat
<#
.SYNOPSIS
Keep a VPN connection alive by periodically issuing a GET
.DESCRIPTION
Keep a VPN connection alive by periodically issuing a GET on a specified URL and log status code.
.PARAMETER url
@megadix
megadix / fetch_all.ps1
Created November 29, 2022 08:25
Powershell git scripts
Get-ChildItem –Path "." -Attributes Directory |
Foreach-Object {
Write-Output "---------------------------------------------"
Write-Output "Processing $_"
Set-Location $_.FullName
git fetch --all --tags --prune
}
Set-Location ..
@megadix
megadix / randomAlpha.js
Created January 15, 2020 09:53
Javascript random alphanumeric
function randomAlpha(n) {
let result = '';
for (let i = 0; i < n; i++) {
const rint = Math.floor(Math.random() * Math.floor(15)) + 10;
const c = rint.toString(26);
result += c;
}
return result;
}
@megadix
megadix / Run-Wiremock.ps1
Last active February 23, 2023 08:18
Start a Wiremock Docker container using Windows PowerShell
<#
.SYNOPSIS
Start a Wiremock Docker container
.DESCRIPTION
This script starts a Docker container using image rodolpheche/wiremock by Rodolphe Chaigneau:
https://hub.docker.com/r/rodolpheche/wiremock/
const axios = require('axios');
const restify = require('restify');
function respond(req, res, next) {
function ok() {
res.send('hello ' + req.params.name);
}
function error(code, data) {
@megadix
megadix / environment.csv
Last active June 24, 2019 10:11
R: read a CSV as a key-value configuration file into a list
key value
rootPath /users/dimitri/data
year 2018
month 2
label a nice label
@megadix
megadix / playRandomMusic.ps1
Last active November 27, 2019 08:38
PowerShell: enqueue and play a random song with VLC
function playMusicForProgramming() {
param(
[int] $n = 1
)
playRandomMusic $n 'C:\download\music\musicforprogramming.net'
}
function playAmbientMusic() {
param(
[int] $n = 1
@megadix
megadix / WildlifePark.fcm.xml
Created May 11, 2017 12:33
Corrected version of "Wildlife Park" example of JFCM library
<?xml version="1.0" encoding="UTF-8"?>
<maps xmlns="http://www.megadix.org/standards/JFCM-map-v-1.2">
<map name="Wildlife Park">
<concepts>
<concept act="TANH" input="0.0" name="Black market price" output="0.0"/>
<concept act="TANH" input="0.0" name="Erbivores" output="0.0"/>
<concept act="TANH" input="0.0" name="Grassland" output="0.0"/>
<concept act="TANH" input="0.0" name="Poachers" output="0.0"/>
<concept act="TANH" input="0.0" name="Predators" output="0.0"/>
<concept act="TANH" input="0.0" name="Rain" output="0.0"/>