Skip to content

Instantly share code, notes, and snippets.

@moriglia
moriglia / RemoveShorts.user.js
Created April 12, 2024 10:11
Youtube Shorts are addictive, hijack me away from them!
// ==UserScript==
// @name RemoveShorts
// @version 1
// @grant none
// @include /^https?://(www\.)?youtube\.com/shorts/.*$/
// ==/UserScript==
window.location = "https://www.youtube.com/watch?v=cErgMJSgpv0"
@moriglia
moriglia / verilog.Makefile
Created October 4, 2023 09:47
Makefile for running verilog testbenches
OUTDIR ?= build
IPROOT ?= ../..
IPPATT ?= $(foreach dir,$(wildcard $(IPROOT)/*/hdl),-y$(dir))
.PHONY: setup default
default: $(OUTDIR)/$(subst .v,.vcd,$(shell find . -name "tb_*.v" -printf "%P\n"))
setup: build
@moriglia
moriglia / equally-high-minipage-figures.tex
Created March 22, 2023 17:59
Render images in equally wide minipages with the same hight
\newlength{\mycustomheight}
\settoheight{\mycustomheight}{\includegraphics[width=0.5\textwidth, keepaspectratio]{wider-image}}
% ^^^^^^^^^^^^ Note this cool trick guys! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
% Figures will have the same height though they are set in equally wide minipages :D
\begin{figure}
\centering
\begin{minipage}{0.5\textwidth}
\centering
\includegraphics[height=\mycustomheight{}, keepaspectratio]{narrower-image}
\caption{Caption of narrow}
@moriglia
moriglia / onedrive-rclone-mount.service
Created November 4, 2021 12:28
Use rclone to mount a remote cloud storage. Make systemd automatically manage the mounting process.
[Unit]
Description="Mount Drive - <Remote Name>"
Wants=network-online.target
After=network-online.target
[Service]
ExecStart=/usr/bin/rclone --vfs-cache-mode writes mount remote_name: /path/to/mountpoint
Restart=on-failure
RestartSec=10
SyslogIdentifier=%i
@moriglia
moriglia / tex.makefile
Last active April 25, 2022 10:14
Makefile for compiling tex files (starting with 3 digits) in pdfs. Tune your pattern in the ALLPDF variable
OUTDIR ?= `pwd`
DRAFTFLAGS = -draftmode --shell-escape -interaction nonstopmode -output-directory $(OUTDIR)
PDFFLAGS = --shell-escape -interaction nonstopmode -output-format pdf -output-directory $(OUTDIR)
ALLPDF = $(patsubst %.tex,%.pdf,$(shell find . -iregex \.\/[0-9]+_.*\.tex))
.PHONY: clean cleanpdf all
all: $(ALLPDF)
+ /classified/**.gpg
- /classified/**
- /.remote
- /.filter
@moriglia
moriglia / avresample.sh
Last active November 3, 2020 19:31
Resample Video and Audio files using ffmpeg. Filter audio to half the new sampling rate.
#!/bin/bash
# Author: Marco Origlia
# License: MIT
# Makes use of argparse.bash: github.com/nhoffman/argparse-bash
ap=$(which argparse.bash)
if [[ ! $ap ]] ; then
@moriglia
moriglia / pidtocommand.sh
Created October 12, 2020 08:24
Get command that has been executed to create the given thread
#!/bin/bash
if [ $# -ne 1 ] ; then
echo "Usage: $0 <pid>";
echo " ";
echo "Get command from pid";
exit -1;
fi
ps -q $1 -o cmd | tail -n 1 ;
@moriglia
moriglia / MicrosoftStreamSortByDate.user.js
Last active July 14, 2020 13:42
Microsoft Streams sorts videos by Trending, but lessons are easily found if sorted by Publish Date. This script authomatically selects this latter option.
// ==UserScript==
// @name MicrosoftStreamSortByDate
// @include /^https?://web\.microsoftstream\.com/group/.*\?view=videos$/
// ==/UserScript==
/* Use this script to sort videos
* by Publish Date automatically
* on Microsoft Stream.
* Inport this script in GreaseMonkey
*/
@moriglia
moriglia / StopDisgustingMedicineVideos.user.js
Created July 12, 2020 12:36
Remove suggested videos in Microsoft Stream
// ==UserScript==
// @name StopDisgustingMedicineVideos
// @include /^https?://web\.microsoftstream\.com/video/.*$/
// ==/UserScript==
/* Import this script in GreaseMonkey
* in order to get rid of suggested videos
* in Microsoft Stream, when they include
* surgical videos you don't feel like
* being suggested to watch