Skip to content

Instantly share code, notes, and snippets.

@erkr
erkr / AutoShutdown.sh
Created May 15, 2022 12:58
TrueNAS Auto shutdown script
#!/bin/bash
# AutoShutdown.sh (c)2022, MIT license, by Eric Kreuwels
# USAGE: AutoShutdown [test|echo]
#
# Shutdown TrueNas systems when idle for a defined timeout period (default 1800 seconds),
# Active during a configurable monitoring timeframe (default between 01:00:00 to 06:30:00).
# Run "AutoShutdown test" to just evaluate the idle checks
# Run "AutoShutdown echo" to echo to stdout instead of the log file
# For normal operation add a "post init script" in truenas: bash /<path>/AutoShutdown.sh&
# Idle is defined as:
@tresf
tresf / dosbox_raw.md
Last active April 10, 2023 18:32
Printing to a raw printer from DOSBox

Printing to a raw printer from DOSBox

Summary

  • Although DOSBox offers printing support, the documentation is sparse and most articles refer to printing on a Windows host.
  • Using DOSBox 0.7.4-3 I was unable to get printing working, so I'm using DOSBox-X instead.
  • Using Ubuntu 20.04 and a fork of DOSBox called DOSBox-X, printing can be configured as follows.

Prerequisites

@viktorklang
viktorklang / service-checklist.md
Created September 20, 2016 12:06 — forked from acolyer/service-checklist.md
Internet Scale Services Checklist

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?
@alirobe
alirobe / reclaimWindows10.ps1
Last active April 26, 2024 17:59
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### UPDATE: For Win 11, I recommend using this tool in place of this script:
### https://christitus.com/windows-tool/
### https://github.com/ChrisTitusTech/winutil
### https://www.youtube.com/watch?v=6UQZ5oQg8XA
### iwr -useb https://christitus.com/win | iex
###
###
@radupotop
radupotop / iperf3.service
Last active January 12, 2019 08:04
iperf3.service for systemd
[Unit]
Description=iperf3 server
After=syslog.target network.target auditd.service
[Service]
User=iperf
ExecStart=/usr/bin/iperf3 -s --logfile /var/log/iperf.log
[Install]
WantedBy=multi-user.target
@sigmaris
sigmaris / file deleted
Last active July 12, 2019 12:56
Deleted Gist
We couldn’t find that file to show.
@ashrithr
ashrithr / graphite.md
Last active September 27, 2020 20:10
Installing graphite 0.10, collectd and grafana on centos 6

Installing Graphite:

Graphite does two things:

  1. Store numeric time-series data
  2. Render graphs of this data on demand

What Graphite does not do is collect data for you, however there are some tools out there that know

@joegoggins
joegoggins / install and add gcc arm to PATH.sh
Last active December 12, 2022 06:59
How I installed GCC ARM on my Mac 10.9 Mac Book Pro
# Download the file manually from here https://launchpad.net/gcc-arm-embedded
# Note: `curl` command doesn't work
# I downloaded this one: "gcc-arm-none-eabi-4_7-2013q3-20130916-mac.tar.bz2"
# double click it to unzip it
# Make a place to install it to
mkdir /usr/local/gcc_arm
# Move the unzipped stuff there.
#coding: utf-8
from logging.handlers import SMTPHandler as _SMTPHandler
class SMTPHandler(_SMTPHandler):
def __init__(self, *args, **kwargs):
super(SMTPHandler, self).__init__(*args, **kwargs)
self._timeout = 15
@higarmi
higarmi / Flatten JSON or a nested dictionary
Created September 26, 2013 01:49
This python recursive function flattens a JSON file or a dictionary with nested lists and/or dictionaries. The output is a flattened dictionary that use dot-chained names for keys, based on the dictionary structure. This allows for reconstructing the JSON structure or converting it to other formats without loosing any structural information.
"""
example: The following JSON document:
{"maps":[{"id1":"blabla","iscategorical1":"0", "perro":[{"dog1": "1", "dog2": "2"}]},{"id2":"blabla","iscategorical2":"0"}],
"masks":{"id":"valore"},
"om_points":"value",
"parameters":{"id":"valore"}}
will have the following output:
{'masks.id': 'valore', 'maps.iscategorical2': '0', 'om_points': 'value', 'maps.iscategorical1': '0',
'maps.id1': 'blabla', 'parameters.id': 'valore', 'maps.perro.dog2': '2', 'maps.perro.dog1': '1', 'maps.id2': 'blabla'}