Skip to content

Instantly share code, notes, and snippets.

use strict;
use Irssi;
use Irssi::Irc;
use vars qw($VERSION %IRSSI);
$VERSION = "0.9";
%IRSSI = (
authors => "xopr",
contact => "xopr\@ackspace.nl",
name => "autorespond",
@xopr
xopr / addkeypair.sh
Created December 8, 2021 08:37
quick script that temporarily allows password login to upload keyfiles for new clients
#!/usr/bin/env bash
# Use xargs to remove trailing space
FQDN=`hostname -A|xargs`
if ! [ $(id -u) = 0 ]; then
echo "Check if you can sudo here (or run this script as root)"
fi
echo "Check client's internet connection and"
echo "create keypair on the client machine by using ONE of the following commands:"
echo "\$ ssh-keygen -t ed25519 -C \"\$USER@\$HOSTNAME\" -f \"\$HOME/.ssh/$FQDN\" -P \"\""
@xopr
xopr / bergeijk.lua
Created December 8, 2021 15:14
Radio Bergeijk extension (saved for backup purposes)
function getEpisodes()
local soundDir = '/mnt/nasi/Media/Muziek/Radio Bergeijk/';
local f = assert(io.popen('find "' .. soundDir .. '" -type f | sort'));
local output = f:read('*all');
f:close();
local episodes = {}
for line in output:gmatch("([^\n]*)\n?") do
if (line ~= '') then
freeswitch.consoleLog('info', line);
@xopr
xopr / espixelflut.lua
Last active December 8, 2021 15:38
freeswitch lua script that allows a user to call in and change the lights
local socket = require 'socket'
local maxbuffer = 100
local pixels = 200
local espixelflutIp = '192.168.1.234'
local espixelflutPort = '1234'
local musicFile = '/mnt/nasi/Media/Muziek/L.E.D. There Be Light (Extended Mix).mp3'
udp = socket.udp()
@xopr
xopr / brightness.py
Created December 20, 2021 08:46
Set display brightness using a slider that works on touch
#!/usr/bin/env python3
# Mostly stolen from https://www.youtube.com/watch?v=ZA_PxLuofV4 / https://learndataanalysis.org/control-lcd-number-widget-with-a-slider-pyqt5-tutorial/
import sys
from PyQt5.QtWidgets import (QApplication, QWidget, QSlider, QHBoxLayout, QDesktopWidget)
from PyQt5.QtCore import Qt
from gi.repository import Gio
from gi.repository import GLib
@xopr
xopr / create_launcher.sh
Created December 20, 2021 14:25
Creates a panel object launcher in MATE desktop
#!/usr/bin/env bash
addPanelItem() {
PANEL_PATH=~/.config/mate/panel2.d/default/launchers/
echo -ne $1
filename=$(basename -- "$1")
extension="${filename##*.}"
filename="${filename%.*}"
@xopr
xopr / checkservice.sh
Created March 20, 2022 15:06
check a set of services: http(s), dns, srv, enum, vpn, radius, spacestate, voip
#!/usr/bin/env bash
# Cannot run anything useful without grep
if ( ! command -v grep &> /dev/null ); then
echo "Cannot continue without grep" >&2
exit 10
fi
ACKSPACE_NL_4="185.145.156.70"
ACKSPACE_NL_6="2a07:4840:0:1::54"
@xopr
xopr / poem.lua
Last active October 28, 2022 15:14
-- Lua implementation of PHP scandir function
function scandir(directory)
freeswitch.consoleLog( "debug", "scanning " .. directory );
local i, t, popen = 0, {}, io.popen
local pfile = popen("ls -a "..directory)
for filename in pfile:lines() do
i = i + 1
t[i] = filename
end
pfile:close()
@xopr
xopr / hybrid.bat
Created September 27, 2018 13:45
batch bash hybrid script
:<<"::CMDLITERAL"
@ECHO OFF
echo Welcome to %COMSPEC%
GOTO :CMDSCRIPT
::CMDLITERAL
echo "Welcome to ${SHELL}"
function REM {
# REM is used to execute linux shell code