Skip to content

Instantly share code, notes, and snippets.

markizano /
Created February 16, 2024 04:15
Clipboard command to convert English to Spanish and back.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Usage: I created a symlink to this file as ~/bin/es2en and ~/bin/en2es, but you can do this with any country code pairs.
# I put this in my `~/.fluxbox/keys`
# Mod4 Shift E :Exec /home/markizano/bin/es2en
# Mod4 Shift S :Exec /home/markizano/bin/en2es
# Restart fluxbox and now I can Win+Shift+E for English
# Win+Shift+S for Spanish
markizano /
Created February 9, 2024 17:44
Using aptly? update your repos with Discord automatically!
exec > >(log update-discord)
exec 2>&1
function aptly() {
sudo -H -uaptly -gapps aptly $@
markizano / nginx.conf
Last active February 3, 2024 18:49
Nginx Configuration File Sample (even logs in JSON format)
View nginx.conf
user nginx apps;
worker_processes 2;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 1024;
multi_accept on;
http {
#log_format extended "$http_host $remote_user@$remote_addr/$remote_port($proxy_add_x_forwarded_for, proxy=$http_proxy) $status($body_bytes_sent) \"$request\" \"$http_referer\" \"$http_user_agent\"";
log_format extended "JSON: {\"time\": \"$time_iso8601\", \"host\": \"$http_host\", \"user\": \"$remote_user\", \"remote\": \"$remote_addr:$remote_port\", \"proxy\": \"$proxy_add_x_forwarded_for\", \"status\": $status, \"response\": $body_bytes_sent, \"request\": \"$request\", \"upstream\": \"$upstream_addr\", \"t_req\": $request_time, \"t_upconn\": \"$upstream_connect_time\", \"t_upheaders\": \"$upstream_header_time\", \"t_upresponse\": \"$upstream_response_time\", \"referer\": \"$http_referer\", \"agent\": \"$http_user_agent\"}";
markizano /
Last active January 29, 2024 16:38
Test a font for being able to render an emoji using ffmpeg
# Tests out the generation of subtitles using a smiley emoji and the "sparkles" emoji.
# Note that some fonts like sans and sans-serif may have the smiley (0xf09f9884), but not the sparkles (0xe29ca8).
# Some fonts will have neither.
# I think support for emojis in FFMPEG/mpv/fonts could use some improvement.
exec 4>
echo "1" >&4
echo "00:00:00.000 --> 00:00:02.000" >&4
markizano /
Last active January 29, 2024 13:20
Run teams as its own user in Linux!
# Teams shell you can add to ~teams/bin/teams and use `update-alternatives` to point to this instead.
# Be sure to add this to `/etc/sudoers.d/teams`
# %apps ALL=(msteams:apps) NOPASSWD: /usr/bin/teams
# I create a `teams` user using this:
# sudo addgroup --gid=200 apps
# sudo adduser --home=/home/apps/teams --shell=/usr/bin/teams --gid=200 --system msteams
markizano / wifi.conf
Created November 1, 2023 02:42
Connect to Wi-Fi service for sysv-init.
View wifi.conf
# Set NETFILE to the location containing the wpa_supplicant network configuration.
# Uncomment the line that is the active network.
export NETFILE=/etc/wifi/My-NET.wifi
#export NETFILE=/etc/wifi/Work-NET.wifi
#export NETFILE=/etc/wifi/Public.wifi
markizano /
Created October 5, 2023 10:48
Common functions to be used in scripts for formatted logging
# This script not intended to run by itself, nor have exec permissions.
# This script intended only for sourcing from other scripts to reduce copy-paste code.
# Redirect STDOUT and STDERR to the system logger (syslog-ng).
function log () {
log_args="$log_args -u/dev/log"
log_args="$log_args -t $1"
markizano / Dockerfile
Last active August 25, 2023 15:57
Voice 2 Text Script based on Whisper
View Dockerfile
FROM devuan/devuan:chimaera
ARG WHISPER_MODEL=guillaumekln/faster-whisper-large-v2
RUN apt-get -q update
RUN apt-get install -qqqy python3-pip ffmpeg git-core
RUN pip3 install nvidia-pyindex
COPY requirements.txt .
markizano / Dockerfile
Last active August 15, 2023 04:33
How I run bitcoin in Docker container
View Dockerfile
FROM devuan/devuan:stable
RUN apt-get update && apt-get install --no-install-recommends -qq -y \
git-core ca-certificates \
make automake autoconf libtool pkg-config dpkg-dev \
gcc g++ clang libc6-dbg \
libboost-all-dev bsdextrautils \
libdb5.3++ libzmq5-dev
markizano /
Created July 27, 2023 16:47
Compiles and installs xmrig and for an automated one-click install. (more secure because it runs xmrig as non-root)
#!/bin/bash -e
test "$UID" -eq 0 && {
ulimit -l 10240
modprobe msr
chgrp msr /dev/cpu/*/msr
chmod g+rw /dev/cpu/*/msr