Skip to content

Instantly share code, notes, and snippets.

View mnn's full-sized avatar

monnef mnn

View GitHub Profile
@mnn
mnn / pa-app-sink-switcher.py
Created December 24, 2022 08:57 — forked from Programie/pa-app-sink-switcher.py
Toggle PulseAudio output sink for the active application
#! /usr/bin/env python3
# This script toggles the PulseAudio output sink of the currently active application (guessed by the currently active X window) between the given output sink and the default output sink.
# The output sink is passed as first argument to the script.
#
# Requirements:
#
# xdotool (on Ubuntu install via "sudo apt install xdotool")
# pulsectl ("sudo pip3 install pulsectl")
#!/usr/bin/env raku
=begin pod
=NAME auto_vid_conv
=VERSION 1.0.0
=head1 DESCRIPTION
Scans current working directory and converts all unconverted mp4 files to specified resolution (e.g. 240p).
Converted files are detected by a prefix (e.g. C<240_>).
@mnn
mnn / colortest-16.sh
Created April 21, 2019 15:50
colortest-16
#!/bin/sh
# $XTermId: 16colors.sh,v 1.13 2003/05/19 00:52:30 tom Exp $
# -----------------------------------------------------------------------------
# this file is part of xterm
#
# Copyright 1999-2002,2003 by Thomas E. Dickey
#
# All Rights Reserved
#
# Permission is hereby granted, free of charge, to any person obtaining a
[cplayer] Command line options: '-v' '--af=pan=6:[1,0,0,0,0,0,0,1,0,0,0,0,1,1,1,0,0,0,1,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,1]' 'vid.webm'
[cplayer] mpv 0.28.0 (C) 2000-2017 mpv/MPlayer/mplayer2 projects
[cplayer] built on Thu Dec 28 00:34:43 UTC 2017
[cplayer] ffmpeg library versions:
[cplayer] libavutil 56.7.100
[cplayer] libavcodec 58.9.100
[cplayer] libavformat 58.3.100
[cplayer] libswscale 5.0.101
[cplayer] libavfilter 7.7.100
[cplayer] libswresample 3.0.101
@mnn
mnn / qmlParser.ts
Created December 27, 2017 18:59
QML parser
/**
* QML parser
* author: monnef
* license: MIT
*/
import fs = require('fs');
import * as P from 'parsimmon';
class ImportToken {
@mnn
mnn / yt.clj
Created August 27, 2017 06:59
YouTube download helper
#!/usr/bin/env clojure
(ns yt.core
(:require [clojure.java.shell :as sh]
[clojure.java.io :as io]))
(def home-dir (System/getProperty "user.home"))
(def download-dir-suffix "/Downloads/yt")
@mnn
mnn / Udash_JSON_GenCodec[Option[T]].scala
Created April 1, 2017 05:59
Udash Option JSON codec
/**
* Udash Option JSON codec for (de)serializing it this way:
* Some(x) will be serialized as x.
* None will be serialized as null.
*/
implicit def optionCodec[T: GenCodec]: GenCodec[Option[T]] =
create[Option[T]](
i => i.inputType match {
case InputType.Null =>
i.readNull()
@mnn
mnn / JoiFromTypeScript.hs
Created January 20, 2017 12:34
JoiFromTypeScript - Converts TypeScript interface and type statements to Joi schema generators.
#!/usr/bin/env runhaskell
{-|
Module : JoiFromTypeScript
Description : Converts TypeScript interface and type statements to Joi schema generators.
Copyright : monnef
Maintainer : monnef2@gmail.com
Stability : experimental
= Dependencies
@mnn
mnn / CustomCondOp.scala
Created November 8, 2016 09:36
Custom conditional operator in Scala with widening support
import util.Random
import scalaz._
import Scalaz._
import CustomCondOp._
trait Card {
println(s"Constructing ${getClass.getSimpleName}")
}
class BigCard extends Card
// 2016.3.2
object Utils {
implicit class FooPimps(f: Foo) {
def implicitMethod(): Unit = println(s"implicit foo method")
}
}