Skip to content

Instantly share code, notes, and snippets.

View avargas's full-sized avatar

Angelo Vargas avargas

View GitHub Profile
@mzpqnxow
mzpqnxow / bash-run-framework.sh
Created July 7, 2021 16:28
Configurable Bash logging, tracing and exception handling with optional JSON logging support
#!/bin/bash
#
# (C) 2021, AG (github@mzpqnxow.com)
# BSD 3-Clause License
#
# Logging and tracing skeleton for Bash shell scripts
#
# Features
# --------
# - Verbose execution tracing to stderr or to a file; optional, via start_trace()
@Jiab77
Jiab77 / simple-multi-threaded-php-web-server.md
Last active September 10, 2023 14:26
An easy way to start the embedded PHP web server with the multi-thread option enabled or simulated when necessary.
@m-radzikowski
m-radzikowski / script-template.sh
Last active June 25, 2024 12:02
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...]
@SamMousa
SamMousa / vm.service
Created September 14, 2020 16:07
Virtualbox on ZFS in SystemD, proper shutdown and process management
# Inspired by https://blogging.dragon.org.uk/start-stop-virtualbox-with-systemd/
[Unit]
Description=Virtual Box Guest %I
After=network.target virtualbox.service zfs-volume-wait.service
Before=runlevel2.target shutdown.target
[Service]
User=root
Group=root
@dave-burke
dave-burke / $JavaScript-Style.md
Last active March 13, 2023 16:59
Simple comparison of the Airbnb and StandardJs style guides

Simple comparison of the Airbnb and StandardJs style guides

Based on the things I actually care about.

Rule Airbnb Standard
Semicolons Required Never
Trailing Comma Required Never
Re-assign function param Never Allowed
++ Never Allowed

Telegraf Technicolor Input Plugin

Telegraf plugin to collect up/down/status from Technicolor Cable Modems.

  1. Make sure Python dependencies are installed; pip install -r reqirements.txt
  2. Move telegraf-technicolor.py in /usr/local/bin or a suitable location to be executed.
  3. Make sure telegraf-technicolor.py is executable; chmod +x telegraf-technicolor.py
  4. Move input.technicolor.conf to /etc/telegraf/telegraf.d or Telegraf configuration location on your system. Adjust any settings, locations, etc. therein as needed, perhaps your measurement names.
  5. Kick Telegraf to reload configuration files.
@githubfoam
githubfoam / iperf cheatsheet
Last active December 2, 2021 12:48
iperf cheatsheet
===================================================server======================================================
$ hostnamectl
Static hostname: control-machine
Icon name: computer-vm
Chassis: vm
Machine ID: 4f8ea72f17144f5a86367a4aeeb5c3e4
Boot ID: b846f130028d48cb960e5498b75d11ef
Virtualization: oracle
Operating System: Ubuntu 18.04.1 LTS
Kernel: Linux 4.15.0-29-generic
@bendera
bendera / multimon.lua
Last active October 24, 2022 05:59
Multi-monitor devilspie2 config
-- https://www.howtoforge.com/tutorial/ubuntu-desktop-devilspie-2/
debug_print("--------------------------------------------------------------------------------")
debug_print("Window Name: ".. get_window_name());
debug_print("Application name: "..get_application_name())
debug_print("--------------------------------------------------------------------------------")
editor_workspace = 1
browser_workspace = 2
terminal_workspace = 1
@ncallister
ncallister / dev-setup.md
Last active June 12, 2024 03:37
Ubuntu Dev Setup

Development Setup for Ubuntu

The following documents is basically notes on tools, repos, etc. to use for development in Ubuntu. It is devided into sections so that it can be used in pieces, it doesn't need to be followed like a script.

Notes

This is likely to end up out-of-date. Things to watch out for:

  • Package archives change, are abandoned or are superseded. Most of the packages archives will need to be checked before they are used.
  • Package names change over time, this is less likely than package archives and I have tried to use generic names for packages wherever possible.
@mottalrd
mottalrd / gist:7ddfd45d14bc7433dec2
Last active March 29, 2022 07:38
Evan Miller source code for sample size from my blog post http://www.alfredo.motta.name/ab-testing-from-scratch/
function num_subjects(alpha, power_level, p, delta) {
var t_alpha2 = ppnd(1.0-alpha/2);
var t_beta = ppnd(power_level);
var sd1 = Math.sqrt(2 * p * (1.0 - p));
var sd2 = Math.sqrt(p * (1.0 - p) + (p + delta) * (1.0 - p - delta));
return (t_alpha2 * sd1 + t_beta * sd2) * (t_alpha2 * sd1 + t_beta * sd2) / (delta * delta);
}