Skip to content

Instantly share code, notes, and snippets.

View sarcasticadmin's full-sized avatar

Robert James Hernandez sarcasticadmin

View GitHub Profile
@ajc
ajc / kermit-serial
Created January 21, 2011 04:02
kermit script to connect to a local serial port
#! /usr/bin/kermit +
;
; copy this to ~/bin/kermit-serial and make executable!
;
set modem type none
set line /dev/ttyUSB0
set carrier-watch off
set speed 9600
if defined \%1 set speed \%1
set flow rts/cts
@splaspood
splaspood / bash_iniparse.sh
Created December 13, 2011 20:34
Parsing INI Files with Bash
cfg.parser () {
fixed_file=$(cat $1 | sed 's/ = /=/g') # fix ' = ' to be '='
IFS=$'\n' && ini=( $fixed_file ) # convert to line-array
ini=( ${ini[*]//;*/} ) # remove comments
ini=( ${ini[*]/#[/\}$'\n'cfg.section.} ) # set section prefix
ini=( ${ini[*]/%]/ \(} ) # convert text2function (1)
ini=( ${ini[*]/=/=\( } ) # convert item to array
ini=( ${ini[*]/%/ \)} ) # close array parenthesis
ini=( ${ini[*]/%\( \)/\(\) \{} ) # convert text2function (2)
ini=( ${ini[*]/%\} \)/\}} ) # remove extra parenthesis
@lyda
lyda / metrics.lua
Last active September 21, 2022 04:16
Prometheus node-exporter in lua for openwrt
#!/usr/bin/lua
-- Metrics web server (0.1)
-- Copyright (c) 2015 Kevin Lyda
-- Apache 2.0 License
socket = require("socket")
netsubstat = {"IcmpMsg", "Icmp", "IpExt", "Ip", "TcpExt", "Tcp", "UdpLite", "Udp"}
cpu_mode = {"user", "nice", "system", "idle", "iowait", "irq",
"softirq", "steal", "guest", "guest_nice"}
netdevsubstat = {"receive_bytes", "receive_packets", "receive_errs",
@fstab
fstab / MATRIX.md
Last active January 5, 2022 12:31
How to use matrix.org and vector.im as an IRC client

How to use matrix.org and vector.im as an IRC client

How to Join an IRC Channel on matrix.org

Join the room #freenode_<#channel>:matrix.org, replacing <#channel> with the name of the IRC channel. For example, in order to join the #prometheus IRC channel, join the room #freenode_#prometheus:matrix.org on matrix.org.

In vector.im, rooms can be joined with the directory symbol on the bottom left.

@j-keck
j-keck / nixos-as-bhyve-guest.md
Last active November 5, 2024 08:38
nixos as bhyve guest

create a vm

root@main:~ # vm create -t debian -s 100G nixos
root@main:~ # vm iso /stuff/downloads/nixos-graphical-18.03.132192.ce0d9d638de-x86_64-linux.iso 
root@main:~ # vm -f install nixos nixos-graphical-18.03.132192.ce0d9d638de-x86_64-linux.iso

boot the image

determine the 'init' executable path from '(cd0)/isolinux/isolinux.cfg'. look for a line which start's with: 'APPEND init=/nix/store/.....'

@ravron
ravron / README.md
Last active August 8, 2024 17:35
Options to prevent accidental Yubikey OTP triggering

Tired of spamming Yubikey one-time password (OTP) codes into Slack? Here are two options to help prevent that. You can do either or both. Both require ykman, the Yubikey CLI configuration manager. Get it with Homebrew:

brew install ykman

If you…

@dan82840
dan82840 / udhcpc.user
Created October 16, 2018 03:50
Put udhcpc.user to /etc/udhcpc.user
#!/bin/sh
#
echo "$@" >>/tmp/udhcpc.dump
echo "========================" >> /tmp/udhcpc.dump
set >> /tmp/udhcpc.dump
echo "========================" >> /tmp/udhcpc.dump
@talawahtech
talawahtech / docker-hub-api.sh
Last active January 16, 2022 14:15
Docker Hub - Create repo with automated build for TechEmpower benchmark
#!/bin/sh
export UNAME=""
export UPASS=""
export DOCKERHUB_NAMESPACE="techempower"
export FRAMEWORK_LANG="C"
export FRAMEWORK="libreactor"
export GITHUB_ORG="TechEmpower"
export GITHUB_REPO="FrameworkBenchmarks"
#Authenticate
with builtins;
let
pkgs = import ../nixpkgs { overlays = []; config={oraclejdk.accept_license = true;}; };
# clean evals
cc1 = pkgs.lib.mapAttrs (n: v: (builtins.tryEval v).value ) (pkgs.recurseIntoAttrs pkgs);
# Only top level derivations
cc2 = pkgs.lib.filterAttrs (n: v: pkgs.lib.isDerivation v) cc1;
# Filter for meta tags
#!/bin/bash
set -eu
usage() {
cat >&2 <<'EOF'
usage: ./difflog $out1 $out2
Compare two Nix build logs, normalizing out boring differences.
This can be useful to test the effect of a change to build scripts,