Skip to content

Instantly share code, notes, and snippets.

Avatar
🏝️
Living the dream

Jeffrey Clark h0tw1r3

🏝️
Living the dream
View GitHub Profile
@h0tw1r3
h0tw1r3 / .bash_dtf
Last active Aug 7, 2021
home directory dot file management with git
View .bash_dtf
#!/bin/bash
# License: MIT
# Copyright 2021 Jeffrey Clark <h0tw1r3@gmail.com>
## Quick Start ##
# export DTF_REPO="ssh://git@github.com/h0tw1r3/.dtf.git"
# source <(curl -s https://github.com/h0tw1r3/.dtf/raw/master/.bash_dtf)
# dtf status
@h0tw1r3
h0tw1r3 / aria2.daemon
Last active Aug 4, 2021
Aria2c systemd service
View aria2.daemon
continue
dir=/var/www/downloads
file-allocation=trunc
max-connection-per-server=4
max-concurrent-downloads=2
max-overall-download-limit=0
min-split-size=25M
@h0tw1r3
h0tw1r3 / rtc-i2c
Last active Apr 27, 2021
Initializing I2C RTC (DS3231) on Raspberry PI bootup with Systemd without recompiling the kernel or devicetree support.
View rtc-i2c
# /etc/conf.d/rtc-i2c
#
# My chip is actually a ds3231n, but ds1307 driver works fine (ds3232 does not!)
#
CHIP="ds1307"
ADDRESS="0x68"
BUS="1"
@h0tw1r3
h0tw1r3 / check_lastupdate.py
Last active Feb 6, 2021
nagios style last system update check for yum, dnf and apt
View check_lastupdate.py
#!/usr/bin/env python
from __future__ import print_function
from datetime import timedelta
from datetime import datetime
import os
import re
import sys
@h0tw1r3
h0tw1r3 / mingw-copy-deps.sh
Created Oct 16, 2015
Recursively copy windows binary (dll/exe) dependencies from a sysroot (mingw toolchain) to the binaries directory.
View mingw-copy-deps.sh
#!/usr/bin/env bash
#
# Copyright: © 2015 Jeffrey Clark <https://github.com/h0tw1r3/>
# License: GPLv3 (http://www.gnu.org/licenses/gpl-3.0.html)
#
set -o errtrace
error() {
echo "ERROR in $0 : line $1 exit code $2"
exit $2
@h0tw1r3
h0tw1r3 / dns-sync.sh
Created Apr 19, 2020
Work-around issues with WSL DNS resolver
View dns-sync.sh
#!/bin/bash
# Based on https://gist.github.com/matthiassb/9c8162d2564777a70e3ae3cbee7d2e95
PATH=/sbin:/bin
WINSYS32=/mnt/c/Windows/System32
PS=$WINSYS32/WindowsPowerShell/v1.0/powershell.exe
CHCP=$WINSYS32/chcp.com
PIDFILE=/var/run/dns-sync.pid
@h0tw1r3
h0tw1r3 / linux-powershell_alias.sh
Last active Apr 19, 2020
WSL bash powershell alias
View linux-powershell_alias.sh
__WINSYS32=/mnt/c/Windows/system32
__POWERSHELL=${__WINSYS32}/WindowsPowerShell/v1.0/powershell.exe
powershell() {
if [ -z "${__OEMCP}" ] ; then
__OEMCP=$(${__WINSYS32}/reg.exe query "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Nls\\CodePage" /v OEMCP 2>&1 | sed -n 3p | tr -d '\015' | grep -o '[[:digit:]]*')
fi
$__WINSYS32/chcp.com $__OEMCP >/dev/null
$__POWERSHELL "$@" | tr -d '\015'
$__WINSYS32/chcp.com 65001 >/dev/null
@h0tw1r3
h0tw1r3 / nsca-ng.spec
Created Jan 8, 2020
RPM spec for packaging nsca-ng 1.6 tested on RHEL/CentOS 6 and 7
View nsca-ng.spec
%if 0%{?fedora} > 17 || 0%{?rhel} > 6
%global systemd_support 1
%else
%global systemd_support 0
%endif
Summary: A modern replacement for NSCA
Name: nsca-ng
Version: 1.6
Release: 1%{?dist}
View lxc-proxmox-noatime
#!/usr/bin/env python2
#
# lxc.hook.pre-start
#
# remounts proxmox container mounts with noatime for performance
#
# copy this file to /usr/share/lxc/hooks/lxc-proxmox-noatime
# create /usr/share/lxc/config/common.conf.d/99-mount-noatime.conf
# with contents: lxc.hook.pre-mount /usr/share/lxc/hooks/lxc-proxmox-noatime
View Crosstool NG 1.22, Raspberry PI
$ git clone -b 1.22 https://github.com/crosstool-ng/crosstool-ng.git
$ cd crosstool-ng
$ ./bootstrap
$ ./configure --prefix=/usr/local
$ make
$ sudo make install
$ cd ..
$ mkdir ctng
$ cd rpi1
$ ct-ng menuconfig