Skip to content

Instantly share code, notes, and snippets.

View ww898's full-sized avatar

Mikhail Pilin ww898

View GitHub Profile
server {
listen 80;
server_name _;
# location /nginx_status {
# stub_status on;
# access_log off;
# }
location ~ ^/(static|[^/]+/[^/]+/static)/(.+)$ {
#! /bin/sh
### BEGIN INIT INFO
# Provides: munin-fastcgi
# Required-Start: $remote_fs $syslog $network
# Required-Stop: $remote_fs $syslog $network
# Should-Start: munin
# Should-Stop: munin
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Startup script for Munin CGI services
#!/bin/bash
txt=$(zpool status)
condition=$(echo "$txt" | egrep -i '(DEGRADED|FAULTED|OFFLINE|UNAVAIL|REMOVED|FAIL|DESTROYED|corrupt|cannot|unrecover)')
if [ "$condition" ]; then
echo "$txt" | mail -s "ZFS health failed" alarm.zfs@localhost
else
echo "$txt" | mail -s "ZFS health ok" info.zfs@localhost
fi
@ww898
ww898 / SetTTL.cmd
Created February 9, 2020 17:13
Set TTL for Beeline
@echo off
netsh int ipv4 set glob defaultcurhoplimit=65
netsh int ipv6 set glob defaultcurhoplimit=65
@ww898
ww898 / node_exporter.service
Last active March 4, 2020 11:45
Run mode_exporter on Raspberry PI
#/lib/systemd/system/node_exporter.service
[Unit]
Description=Node Exporter
After=network.target
[Service]
User=monituser
Group=monituser
ExecStart=/opt/node_exporter/node_exporter --collector.textfile.directory /var/lib/node_exporter/textfile_collector
#/lib/systemd/system/raspberrypi_exporter.timer
[Unit]
Description=Timer for the Raspberry Pi Prometheus exporter
[Timer]
OnCalendar=*:*:0,10,20,30,40,50
AccuracySec=1sec
[Install]
#/lib/systemd/system/raspberrypi_exporter.service
[Unit]
Description=Prometheus exporter for Raspberry Pi metrics
Wants=raspberrypi_exporter.timer
[Service]
Type=oneshot
User=monituser
Group=monituser
@ww898
ww898 / boot_from_usb_ubuntu_18.04.sh
Last active April 7, 2020 08:21
Switch booting from SD card to USB drive on Raspberry Pi 4 under ubuntu 18.04.
#!/bin/bash
set -exuo pipefail
# Connect USB drive with clean copy of Ubuntu 18.04 image only before run this script!!!
sudo sfdisk --list /dev/mmcblk0
sudo sfdisk --list /dev/sda
read -p "Press [Enter] key to start modifying partition table..."
@ww898
ww898 / get-version.sh
Last active October 6, 2021 16:08
Get macOS version
#!/usr/bin/env osascript -l JavaScript
values = ObjC.deepUnwrap($.NSProcessInfo.processInfo.operatingSystemVersion)
for (name in values) {
console.log(name, values[name])
}
plugin load sos/libsosplugin
setsymbolserver https://resources.jetbrains.com/pdb/
setsymbolserver https://msdl.microsoft.com/download/symbols/
setsymbolserver http://symbols.labs.jb.gg/symbols/
loadsymbols