Skip to content

Instantly share code, notes, and snippets.

View szampardi's full-sized avatar

Silvano Zampardi szampardi

View GitHub Profile

Keybase proof

I hereby claim:

  • I am szampardi on github.
  • I am szampardi (https://keybase.io/szampardi) on keybase.
  • I have a public key whose fingerprint is C82B 9604 7310 0D65 E181 5FC1 9EDA 6A85 887E FB0B

To claim this, I am signing this object:

@szampardi
szampardi / beets.Dockerfile
Created January 14, 2021 13:28
beets Dockerfile
FROM ubuntu:bionic
SHELL ["/bin/bash", "-xeo", "pipefail", "-c"]
RUN export DEBIAN_FRONTEND=noninteractive; \
apt-get update; \
apt-get dist-upgrade -yqq; \
apt-get install -yqq --no-install-recommends python3-pip python3-setuptools; \
pip3 install --no-cache beets pylast
ENTRYPOINT ["/usr/bin/beet"]
@szampardi
szampardi / grapheneos-release.sh
Last active March 15, 2023 06:13
grapheneOS build steps (pixel 5)
#!/bin/bash -ex
# https://developers.google.com/android/ota#redfin
export DEVICE=${1:-redfin}
# https://grapheneos.org/releases#redfin-stable
export TAG_NAME=${2}
export PATCH_LEVEL=$(cut -d'.' -f1,2,3 <<<"${TAG_NAME}")
_patch_level=$(tr '[:upper:]' '[:lower:]' <<<"${PATCH_LEVEL}")
mkdir grapheneos
# vc_redist.x64.exe 2015
# https://www.microsoft.com/en-us/download/details.aspx?id=48145
#!/bin/bash
cd /home/${USER}/.steam
#rm -fr steam/steamapps/common/AoE2DE/resources/_common/movies
#rm -fr steam/steamapps/common/AoE2DE/resources/en/campaign/movies
find steam/steamapps/common/AoE2DE -type d -name movies -exec rm -vrf {} \;
@szampardi
szampardi / thing.sh
Created October 19, 2021 01:43
CMU sphinx lmtool-new curl
curl -sL -F formtype=simple -F [email protected] http://www.speech.cs.cmu.edu/cgi-bin/tools/lmtool/run | grep -o 'http*://[^"]*'
@szampardi
szampardi / gpu-oc.sh
Last active October 21, 2021 20:21
nvidia-settings headless gpu oc
#!/bin/bash -e
# gpus.json
# to find out uuid, first match PCI port with GPU UUID
# #> lspci -vnn | grep VGA -A 2 && cat /proc/driver/nvidia/gpus/*/information
# then confirm
# #> nvidia-smi -L
if [[ -z ${1} ]] || [[ ! -s ${1} ]]; then
printf 'must provide json config file with first argument\n'
@szampardi
szampardi / cip.go
Last active October 28, 2021 23:36
package main
import (
"encoding/hex"
"encoding/json"
"flag"
"fmt"
"net"
"os"
"os/signal"
@szampardi
szampardi / cortex.sh
Last active September 21, 2023 17:33
use a json file for shell vars
#!/usr/bin/env bash
CORTEX_CRYPTO="aes-256-cbc"
_cortex_logger() { printf '{%s}[%s](%s):%s\t%s\n' "$(date -u '+%FT%TZ')" "${1}" "$(caller)" "${2}" "${@:3}" 1>&2; }
_cortex_io() {
case "${CORTEX_FILE}" in
"") _cortex_logger "$(caller)" ERR "CORTEX_FILE environment variable is empty/unset" && return 127 ;;
*)
@szampardi
szampardi / github_to_gitea.go
Last active April 22, 2022 20:14
migrate user/org repos to gitea user/org
package main
import (
"bufio"
"context"
"encoding/json"
"flag"
"fmt"
"os"
"strconv"
#!/bin/bash -ex
_gpio="${1}"
_direction="${2:-out}"
if [[ ! -d /sys/class/gpio/gpio"${_gpio}" ]]; then
echo "${_gpio}" >/sys/class/gpio/export
fi
echo "${_direction}" >/sys/class/gpio/gpio"${_gpio}"/direction