Skip to content

Instantly share code, notes, and snippets.

@webern
webern / docker-commands.md
Last active March 8, 2023 21:35
Nuke Docker from Orbit

You can double-check the docker data directory with this, but I considered too dangerous to include in the rm -rf command.

docker info | grep 'Docker Root Dir' | grep -oE '/.*'

Nuke Docker from Orbit

@lwilli
lwilli / prettify_xml.rs
Created March 11, 2021 17:12
Prettify XML in Rust using the quick_xml library
use quick_xml::events::Event;
use quick_xml::{Reader, Writer};
/// Prettify XML by adding proper new lines and indentation.
///
/// This uses the quick_xml library (https://github.com/tafia/quick-xml) to read/parse the given
/// XML string and then write it to a string as indented XML. This isn't perfect and most likely
/// not the most efficient.
///
/// One strange behavior is that a closing element tag is not put on a new line if it follows a
@adewes
adewes / track_temperature.sh
Last active February 28, 2024 16:33
Temperature Tracking Script
#!/bin/bash
# logs the temperature every minute
# sends a message if it is too high or low or if it can't be measured
# also sends a message at a given time every day
#sensor ID (must be a DS18B20 sensor)
SENSOR_ID="28-011453d372aa"
# hour when to send the message
REF_HOUR="17:00"
# maximum temperature
@SqyD
SqyD / ventilation.yaml
Last active April 14, 2023 07:48
ESPHome PWM fan using a Wemos D1 mini lite
# Controlling my Buva Qstream ventilation system using:
# * A Wemos D1 mini lite (an ESP8266 based board)
# * A Wemos power shield so I can power the Wemos from the ventilation units 12V supply.
# * A simple PWM to 10V convertor like this: https://www.cheaptech.nl/pwm-signaal-te-voltage-converter-1-3-khz-0-10-v-pw.html
# * The amazing ESPHome firmware tool: https://esphome.io
# * Home Assistant to tie it all together: https://www.home-assistant.io
#
# I used to use a Raspberry Pi and some Python code for this. See https://gist.github.com/SqyD/a927ab612df767a0cc892bcde23d025c
# The Wemos approach seems more stable and doesn't require external USB power.
@boseji
boseji / Rapi-Secure.md
Last active July 8, 2024 05:08
Securing the Raspberry Pi
@trygveaa
trygveaa / wlan
Created May 11, 2016 17:02
Wrapper around wpa_cli for less typing
#!/bin/bash
wpa_cli='wpa_cli -i wlp2s0'
if [ -z "$1" ]; then
$wpa_cli status
elif [ "$1" == "c" ]; then
$wpa_cli
elif [ "$1" == "l" ]; then
$wpa_cli list_networks
@vivianspencer
vivianspencer / server_hardening.md
Last active February 17, 2022 13:29
Debian 8 Hardening

Debian 8 Hardening

  1. Update root's mail recipient. Open /etc/aliases replacing administrator@example.tld with an administrator's email address. This is where logs will be emailed.

    root:     administrator@example.tld
    
  2. Update the the default umask to 027. Edit the file /etc/init.d/rc and change the following setting:

umask 027

@rxaviers
rxaviers / gist:7360908
Last active July 22, 2024 19:42
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@sos4nt
sos4nt / xterm-256color-italic.terminfo
Created July 27, 2012 12:13
A xterm-256color based TERMINFO that adds the escape sequences for italic
# A xterm-256color based TERMINFO that adds the escape sequences for italic.
#
# Install:
#
# tic xterm-256color-italic.terminfo
#
# Usage:
#
# export TERM=xterm-256color-italic
#
@jbeluch
jbeluch / irssi-connect.sh
Created April 1, 2011 19:54
irssi remote notification via ssh
#!/bin/sh
# If we get an argument, use it for ssh port, otherwise use default of 22
if [ -n "$1" ]
then
port=$1
else
port=22
fi