Skip to content

Instantly share code, notes, and snippets.

View daryltucker's full-sized avatar

Daryl Tucker daryltucker

  • Neo-Retro Group
  • Salem, Or
View GitHub Profile
@yellowcrescent
yellowcrescent / amazon_total.py
Last active June 20, 2018 17:58
Calculate total Amazon spending from Order Report
#!/usr/bin/env python
# vim: set ts=4 sw=4 expandtab:
"""
amazon_total.py
Calculate total cost of Amazon orders
Usage:
- Login to your Amazon account, then click on 'Download order reports'
Choose the time period, and Amazon will generate a CSV file for you.
@yellowcrescent
yellowcrescent / nginx_sockuser.diff
Last active April 4, 2019 23:12
add sock_user, sock_group, sock_perm options to nginx listen directive
diff -r 72d3aefc2993 src/core/ngx_connection.c
--- a/src/core/ngx_connection.c Wed Jul 26 13:13:51 2017 +0300
+++ b/src/core/ngx_connection.c Fri Jul 28 22:39:23 2017 -0400
@@ -87,6 +87,12 @@
ls->fastopen = -1;
#endif
+#if (NGX_HAVE_UNIX_DOMAIN)
+ ls->sock_user = -1;
+ ls->sock_group = -1;
@Brainiarc7
Brainiarc7 / skylake-tuning-linux.md
Last active October 5, 2025 15:02
This gist will show you how to tune your Intel-based Skylake, Kabylake and beyond Integrated Graphics Core for performance and reliability through GuC and HuC firmware usage on Linux.

Tuning Intel Skylake and beyond for optimal performance and feature level support on Linux:

Note that on Skylake, Kabylake (and the now cancelled "Broxton") SKUs, functionality such as power saving, GPU scheduling and HDMI audio have been moved onto binary-only firmware, and as such, the GuC and the HuC blobs must be loaded at run-time to access this functionality.

Enabling GuC and HuC on Skylake and above requires a few extra parameters be passed to the kernel before boot.

Instructions provided for both Fedora and Ubuntu (including Debian):

Note that the firmware for these GPUs is often packaged by your distributor, and as such, you can confirm the firmware blob's availability by running:

@yellowcrescent
yellowcrescent / Makefile
Created December 11, 2016 03:35
makefile for pinger thing
# Trying to build a fucking makefile
# jacob AVR makefile
#BUILDNAME=BLINKTEST
BUILDNAME=PINGER-2016
## Program names
CC=avr-gcc
CXX=avr-g++
OBJ2HEX=avr-objcopy
@Brainiarc7
Brainiarc7 / transient-clustering-gnu-parallel-sshfs.md
Last active September 2, 2024 13:53
How to set up a transient cluster using GNU parallel and SSHFS for distributed jobs (such as FFmpeg media encodes)

Transient compute clustering with GNU Parallel and sshfs:

GNU Parallel is a multipurpose program for running shell commands in parallel, which can often be used to replace shell script loops,find -exec, and find | xargs. It provides the --sshlogin and --sshloginfile options to farm out jobs to multiple hosts, as well as options for sending and retrieving static resources and and per-job input and output files.

For any particular task, however, keeping track of which files need to pushed to and retrieved from the remote hosts is somewhat of a hassle. Furthermore, cancelled or failed runs can leave garbage on the remote hosts, and if input and output files are large, sending them to local disk on the remote hosts is somewhat inefficient.

In a traditional cluster, this problem would be solved by giving all nodes access to a shared filesystem, usually with NFS or something more exotic. However, NFS doesn't wo

@Brainiarc7
Brainiarc7 / ffmpeg-multi-instances-xargs.md
Last active November 11, 2024 15:31
This gist will show you how to launch multiple ffmpeg instances with xargs, very useful for NVIDIA NVENC based encoding where standard GPUs limit the maximum simultaneous encode sessions to two.

Spawning multiple ffmpeg processes with xargs:

On standard NVIDIA GPUs (Not the Quadros and Tesla lines), NVENC encodes are limited to two simultaneous sessions. The sample below illustrates how to pass a list of AVI files to ffmpeg and encode them to HEVC on two encode sessions:

$ find Videos/ -type f -name \*.avi -print | sed 's/.avi$//' |\
  xargs -n 1 -I@ -P 2 ffmpeg -i "@.avi" -c:a aac -c:v hevc_nvenc "@.mp4"

This will find all files with the ending .avi in the directory Videos/ and transcode them into HEVC/H265+AAC files with the ending .mp4. The noteworthy part here is the -P 2 to xargs, which starts up to two processes in parallel.

@kinifi
kinifi / index.html
Created November 26, 2016 21:31
Minecraft Overviewer has a google API key error. Here is how to fix it
<!DOCTYPE html>
<html>
<head>
<title>{title}</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Minecraft-Overviewer {version}" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
@MightyPork
MightyPork / usb_hid_keys.h
Last active November 6, 2025 19:03
USB HID Keyboard scan codes
/**
* USB HID Keyboard scan codes as per USB spec 1.11
* plus some additional codes
*
* Created by MightyPork, 2016
* Public domain
*
* Adapted from:
* https://source.android.com/devices/input/keyboard-devices.html
*/
@Brainiarc7
Brainiarc7 / ffmpeg-howto-localfiles-manipulation.md
Created July 25, 2016 13:43
This is a standard how-to for FFmpeg's usage with local files and streams. Small hand-book detailing common encode scenarios in a standard workflow.

Standard FFmpeg How-to

Table of Contents

* Generic Syntax

* Main Options

* Encoding :
@tvlooy
tvlooy / unit.sh
Last active August 20, 2025 15:42
Bash test: get the directory of a script
#!/bin/bash
function test {
MESSAGE=$1
RECEIVED=$2
EXPECTED=$3
if [ "$RECEIVED" = "$EXPECTED" ]; then
echo -e "\033[32m✔︎ Tested $MESSAGE"
else