Skip to content

Instantly share code, notes, and snippets.

@shitpoet
shitpoet / 060-rnn-voice.conf
Created November 25, 2023 22:15
rnn-voice filter-chain module conf for pipewire
context.modules = [
{ name = libpipewire-module-filter-chain
args = {
node.description = "rnn-voice"
media.name = "rnn-voice"
filter.graph = {
nodes = [
{
type = ladspa
name = rnnoise
@shitpoet
shitpoet / 070-deesser.conf
Last active November 25, 2023 22:14
pipewire deesser using calf lv2 plugin
context.modules = [
{
name = libpipewire-module-filter-chain
flags = [ nofail ]
args = {
node.description = "Deesser source"
media.name = "Deesser source"
filter.graph = {
nodes = [
{
@shitpoet
shitpoet / execute-code-from-memory-x64-linux.c
Created June 1, 2023 15:57
How to execute an array of bytes as code on x86-64 under linux
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <sys/mman.h>
#include <unistd.h>
typedef int (*f)(int);
//typedef int (*f)();
@shitpoet
shitpoet / cscsi.sh
Created February 1, 2020 22:17
execute cs script from stdin using cs-script (cscs)
#!/bin/bash
# echo "using System; class App { public static void Main() { Console.WriteLine(1 + 1); } }" | cscsi.sh
# cat hello.cs | cscsi.sh
tmpfile=$(mktemp -p /dev/shm XXXXXXXXXXXXX.cs)
trap "rm -f '$tmpfile'" exit int term
cat > $tmpfile
cscs -ac $tmpfile
@shitpoet
shitpoet / udp-audio.kt
Created August 25, 2019 10:21
Low-latency capturing and sending, receiving and playing audio over UDP on Android 8.1. Converts a phone to an Wi-Fi UDP headset. This code is a prototype!
/* add to manifest:
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.INTERNET"/>
*/
package com.example.myapplication
import android.app.AlertDialog
import android.app.PendingIntent.getActivity
import androidx.appcompat.app.AppCompatActivity
@shitpoet
shitpoet / add-to-recent
Last active January 9, 2019 20:00
Add a file to GNOME's recent files list
#!/bin/bash
f=~/.local/share/recently-used.xbel
s=`cat $f`
t=`echo "$s" | sed 's/<\/xbel>//g'`
target="$@"
dt=`date '+%Y-%m-%dT%H:%M:%SZ'`
mime=`file -b --mime-type "$target"`
##.pagedlist_item:has(a[target="_blank"] > p:has-text(/\sby\s/))
##.pagedlist_item:has(a[target="_blank"] > p:has-text(/\sad\s\sby/))
##.pagedlist_item:has(a[target="_blank"] > p:has-text(/\spromoted\s\sby/))
@shitpoet
shitpoet / jikl.ahk
Created May 19, 2018 08:58
Autohotkey script to redirect navigation keys to home row
; redirect nav keys to home row
; alt+arrows to jikl and some more
; !r::Reload
; redirect alt+keys saving other mods
Redirect(key) {
if GetKeyState("Shift", "D")
if GetKeyState("Ctrl", "D")
Send +^{%key%}
@shitpoet
shitpoet / haml.lua
Created April 7, 2017 19:34
basic HAML lexer for TextAdept
-- Copyright 2006-2015 Mitchell mitchell.att.foicica.com. See LICENSE.
-- HAML LPeg lexer.
local l = require('lexer')
local token, word_match = l.token, l.word_match
local P, R, S, V = lpeg.P, lpeg.R, lpeg.S, lpeg.V
local M = {_NAME = 'haml'}
-- Whitespace.
@shitpoet
shitpoet / error.js
Created January 17, 2017 04:10
Reimplementation of default uncaught exception handler of nodejs
// reimplementation of default uncaught exception handler of nodejs v7.2 in js
//
// produces the same output as default handler of nodejs
// handles inline source maps with sinlge source (as V8 does)
// does not handle non-inline source maps or maps with multiple sources
//
// shitpoet@gmail.com, public domain
"use strict";