Skip to content

Instantly share code, notes, and snippets.

@Nako
Nako / hddtemp.sh
Last active April 28, 2024 12:15
hard disk temperature, very simple script to print block device, model information, serial number, state, and temperature
#!/bin/bash
# https://gist.github.com/Nako/21d1a857fefae950d9afe8d9e4641af9
# very simple script to print block device - model - state - temperature
grep -l "drivetemp" /sys/class/hwmon/hwmon*/name | while read f;\
do echo `ls ${f%/*}/device/block` - `smartctl -a /dev/\`ls ${f%/*}/device/block\`| grep -i "Family"` - `smartctl -a /dev/\`ls ${f%/*}/device/block\`| grep -i "Serial"` - `cat ${f%/*}/device/model` - `cat ${f%/*}/device/state` - $((`cat ${f%/*}/temp1_input`/1000));
done
@Nako
Nako / gist:f602f11c9432a61a7f913a70d0523cd4
Created March 13, 2024 15:42
Ansibple playbook to disable cloudinit networking configuration, install ifupdown, and create/generate /etc/network/interfaces file on debian based systems
---
- name: Disable cloudinit networking configuration, install ifupdown, and create/generate /etc/network/interfaces file
hosts: all
gather_facts: true
tasks:
- name: disable cloudinit networking configuration /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
ansible.builtin.copy:
content: |
network: {config: disabled}
@Nako
Nako / easy_window_drag.ahk
Created August 7, 2023 10:15 — forked from Elijas/easy_window_drag.ahk
Easy Window Drag (KDE) - Allows to drag/resize windows by clicking and dragging mouse buttons while holding a modifier key. No more sniping the windows corners - just hovering the window becomes enough.
; Easy Window Dragging -- KDE style (requires XP/2k/NT) -- by Jonny
; http://www.autohotkey.com
; This script makes it much easier to move or resize a window: 1) Hold down
; the ALT key and LEFT-click anywhere inside a window to drag it to a new
; location; 2) Hold down ALT and RIGHT-click-drag anywhere inside a window
; to easily resize it; 3) Press ALT twice, but before releasing it the second
; time, left-click to minimize the window under the mouse cursor, right-click
; to maximize it, or middle-click to close it.
; This script was inspired by and built on many like it
@Nako
Nako / docker-compose-backup.sh
Created March 7, 2023 06:16 — forked from pirate/docker-compose-backup.sh
Backup a docker-compose project, including all images, named and unnamed volumes, container filesystems, config, logs, and databases.
#!/usr/bin/env bash
### Bash Environment Setup
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
# https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
# set -o xtrace
set -o errexit
set -o errtrace
set -o nounset
set -o pipefail
@Nako
Nako / docker_wordpress.md
Created February 4, 2023 12:21 — forked from bradtraversy/docker_wordpress.md
Docker Compose FIle For Wordpress, MySQL & phpmyadmin

Wordpress & Docker

This file will setup Wordpress, MySQL & PHPMyAdmin with a single command. Add the code below to a file called "docker-compose.yaml" and run the command

$ docker-compose up -d

# To Tear Down
$ docker-compose down --volumes
@Nako
Nako / gist:470f40295f720a2e967447ed1fbfee34
Created November 20, 2022 15:54 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.


Updated Apr 5 2019:

because this is a gist from 2011 that people stumble into and maybe you should AES instead of 3DES in the year of our lord 2019.

some other notes:

@Nako
Nako / disk-usage-alert.sh
Last active February 22, 2022 11:25 — forked from M1ke/disk-usage-alert.sh
A shell script to check your disk usage and alert you if it hits a limit. Change the value (percentage) in the "if" statement on line 7 to alter the threshold. Change the email address to your email address. See readme for mail.cf instructions and crontab.
#!/bin/sh
EMAILTO="user@example.com"
THRESHOLD=90 # if above $THRESHOLD is used -> send email notification to $EMAILTO
DFALL=$(df -h)
df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output;
do
echo $output
used=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 )
partition=$(echo $output | awk '{ print $2 }' )
I1112 09:22:13.318824 18806 initconfiguration.go:116] detected and using CRI socket: /var/run/dockershim.sock
I1112 09:22:13.318956 18806 interface.go:431] Looking for default routes with IPv4 addresses
I1112 09:22:13.318959 18806 interface.go:436] Default route transits interface "eth0"
I1112 09:22:13.319010 18806 interface.go:208] Interface eth0 is up
I1112 09:22:13.319027 18806 interface.go:256] Interface "eth0" has 1 addresses :[10.0.2.15/24].
I1112 09:22:13.319035 18806 interface.go:223] Checking addr 10.0.2.15/24.
I1112 09:22:13.319038 18806 interface.go:230] IP found 10.0.2.15
I1112 09:22:13.319041 18806 interface.go:262] Found valid IPv4 address 10.0.2.15 for interface "eth0".
I1112 09:22:13.319044 18806 interface.go:442] Found active IP 10.0.2.15
@Nako
Nako / debian-install-megacli.md
Created September 16, 2021 06:05 — forked from fxkraus/debian-install-megacli.md
Install LSI MegaCli .deb package on Debian/Ubuntu

download

wget https://docs.broadcom.com/docs-and-downloads/raid-controllers/raid-controllers-common-files/8-07-14_MegaCLI.zip

unzip

unzip 8-07-14_MegaCLI.zip
@Nako
Nako / devops_best_practices.md
Created March 11, 2021 08:10 — forked from jpswade/devops_best_practices.md
Devops Best Practices Checklist

Find the original here article here: Devops Best Practices

DevOps started out as "Agile Systems Administration". In 2008, Andrew Shafer did a talk called "Agile Infrastucture" addressing issues around involving more of the company in the same disciplines as programmers.

In 2009, Patrick Debois created "DevOpsDays" conference to help to bring it to light. However, it wouldn't begin to trend until about 2010, when people would begin to describe it as a standalone discipline.

Today, DevOps goes beyond just developers, systems administration and infrastructure, its about [dev, ops, agile, cloud