Skip to content

Instantly share code, notes, and snippets.

View zenofile's full-sized avatar

zenofile zenofile

View GitHub Profile
@zenofile
zenofile / script-template.sh
Created December 16, 2020 18:37 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@zenofile
zenofile / systemd_service_hardening.md
Created May 14, 2021 21:32 — forked from ageis/systemd_service_hardening.md
Options for hardening systemd service units

security and hardening options for systemd service units

A common and reliable pattern in service unit files is thus:

NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
DevicePolicy=closed
ProtectSystem=strict
AWSTemplateFormatVersion: '2010-09-09'
Description: Extreme Performance Tuning Benchmark Environment
Parameters:
AmiId:
Type: AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>
Default: '/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2'
@zenofile
zenofile / txq.bt
Created May 22, 2021 02:33 — forked from talawahtech/txq.bt
txq.bt - monitor the length of an AWS ENA device's transmit queue
#include "txq.h"
kprobe:ena_com_prepare_tx
{
// grab/cast the transmit queue param
$io_sq = (struct ena_com_io_sq *) arg0;
// logic copied from from ena_com_free_q_entries
$queuelen = (uint16) $io_sq->tail - (uint16) $io_sq->next_to_comp;
@zenofile
zenofile / netmonitor.sh
Created May 22, 2021 02:35 — forked from talawahtech/netmonitor.sh
netmonitor.sh - A simple bash script to calculate throughput and pps
#!/bin/bash
# Bash script to calculate throughput and packets/sec
# Based on code from https://discuss.aerospike.com/t/benchmarking-throughput-and-packet-count-with-iperf3/2791
if [ -z "$1" ]; then
echo
echo usage: $0 [network-interface]
echo
echo defaulting to eth0
@zenofile
zenofile / README.md
Created May 22, 2021 03:03 — forked from pamolloy/README.md
Mesh network using VXLAN over Wireguard
@zenofile
zenofile / build.sh
Last active January 21, 2025 13:18
Building a static tmux binary with musl
#!/usr/bin/env bash
set -o errexit
MUSL_VERSION=1.2.5
LIBEVENT_VERSION=2.1.12
NCURSES_VERSION=6.5
TMUX_VERSION=3.5a
TARGETDIR=$1
/*
* ctx_time Copyright (C) 2018 Matteo Croce <[email protected]>
* a tool measure the context switch time in clock cycles
*/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <limits.h>
#include <string.h>
@zenofile
zenofile / remove_old_builds.sql
Created April 13, 2022 01:39 — forked from david-zw-liu/remove_old_builds.sql
Keep 1000 builds per repos for DroneCI (sqlite3 version >= 3.25 required)
-- Thank @sbengo to figure out foreign_keys constraints is defaults to false in sqlite
-- Enable to delete logs by cascading delete
PRAGMA foreign_keys = ON;
WITH n_build_ids_per_repo as (
SELECT build_id
FROM (
SELECT
build_id,
build_repo_id,
@zenofile
zenofile / VAAPI-hwaccel-encode-Linux-Ffmpeg&Libav-setup.md
Created August 4, 2022 21:29 — forked from Brainiarc7/VAAPI-hwaccel-encode-Linux-Ffmpeg&Libav-setup.md
This gist contains instructions on setting up FFmpeg and Libav to use VAAPI-based hardware accelerated encoding (on supported platforms) for H.264 (and H.265 on supported hardware) video formats.

Using VAAPI's hardware accelerated video encoding on Linux with Intel's hardware on FFmpeg and libav

Hello, brethren :-)

As it turns out, the current version of FFmpeg (version 3.1 released earlier today) and libav (master branch) supports full H.264 and HEVC encode in VAAPI on supported hardware that works reliably well to be termed "production-ready".