Skip to content

Instantly share code, notes, and snippets.

View hansdg1's full-sized avatar

Hans Guthrie hansdg1

View GitHub Profile
@hansdg1
hansdg1 / smartcheck.sh
Created May 25, 2018 05:15 — forked from tommybutler/smartcheck.sh
Script to quickly scan the S.M.A.R.T. health status of all your hard drive devices in Linux (at least all the ones from /dev/sda to /dev/sdzz). You need smartctl installed on your system for this script to work, and your hard drives need to have S.M.A.R.T. capabilities (they probably do).
#!/bin/bash
# install the smartctl package first! (apt-get install smartctl)
if sudo true
then
true
else
echo 'Root privileges required'
#!/usr/bin/env bash
#set -x
LAST_KERNEL=`/bin/rpm -q --last kernel | /usr/bin/head -1 | /usr/bin/perl -pe 's/^kernel-(\S+).*/$1/'`
RUNNING_KERNEL=`uname -r`
if [[ $LAST_KERNEL != $RUNNING_KERNEL ]];
then
echo "**Reboot pending**"
echo -e "Installed $LAST_KERNEL\nRunning $RUNNING_KERNEL" | column -t
else
@hansdg1
hansdg1 / Makefile
Created August 30, 2017 18:48
Makefile for tmux-xpanes
# DESTDIR is defined in dh_auto_install
# Ref: https://www.debian.org/doc/manuals/maint-guide/modify.ja.html
BINDIR=$(DESTDIR)/usr/local/bin
BIN1_DEST=bin/tmux-xpanes
BIN2_DEST=bin/xpanes
MANDIR=$(DESTDIR)/usr/local/share/man/man1
MAN1_DEST=man/tmux-xpanes.1
MAN2_DEST=man/xpanes.1
INSTALL?=/usr/bin/install
RM?=/bin/rm -f

Keybase proof

I hereby claim:

  • I am hansdg1 on github.
  • I am hansdg1 (https://keybase.io/hansdg1) on keybase.
  • I have a public key ASB8pSId1DDLFUDda9DzPAhhkpfFVds37h3VUbQQWVMlTwo

To claim this, I am signing this object:

@hansdg1
hansdg1 / gist:0c54c3578259ce7d37a6b9f0362712b1
Created April 27, 2017 23:44
nginx config for blog2.hansguthrie.com
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name blog2.hansguthrie.com www.blog2.hansguthrie.com;
include /etc/nginx/snippets/letsencrypt.conf;
location / {
return 301 https://blog2.hansguthrie.com$request_uri;
}
import javax.crypto.Cipher;
class CipherTest {
public static void main(String args[]) {
try {
int maxKeyLen = Cipher.getMaxAllowedKeyLength("AES");
if(maxKeyLen < 256) {
System.out.println("FAILED: Max key length too small! (" + maxKeyLen + ").");
} else {
System.out.println("PASSED: Max key length OK! (" + maxKeyLen + ").");
}
@hansdg1
hansdg1 / # ffmpeg - 2017-02-08_00-02-12.txt
Created March 13, 2017 23:02
ffmpeg on macOS 10.11.6 - Homebrew build logs
Homebrew build logs for ffmpeg on macOS 10.11.6
Build date: 2017-02-08 00:02:12
tmux is a "terminal multiplexer", it enables a number of terminals to be accessed and controlled from a single terminal.
If you use Debian/Ubuntu, you can just run apt-get install tmux, and voila.
Since the title was about centos 7, then do the following step to install tmux.
(1). tmux has a library dependency on libevent which, of course, isn’t installed by default.
$ wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
$ tar xzvf libevent-2.0.21-stable.tar.gz
$ cd libevent-2.0.21-stable
@hansdg1
hansdg1 / gist:a2b6e683650381971e489512aff5b378
Created November 13, 2016 21:34
Check ubuntu/debian has a reboot pending. If so, print details
alias rbr2="if [ -f /var/run/reboot-required ]; then cat /var/run/reboot-required; echo -e 'Packages pending reboot:'; cat /var/run/reboot-required.pkgs | sed 's/^/ /' ; fi"
@hansdg1
hansdg1 / install_my_packages.sh
Last active January 22, 2017 00:13
Automatically install packages after a firmware upgrade to the ERLite
#!/bin/bash
# Installed by: Hans Guthrie
# Date: 11/6/2016
# Install dir: /config/scripts/post-config.d/
# Notes: The purpose of this file is to automatically install packages after a firmware upgrade to the
# ERLite. After every upgrade, the /config directory is copied to the new image.
# Followed steps from here:
# https://help.ubnt.com/hc/en-us/articles/204961814-EdgeMAX-Are-my-changes-lost-when-I-upgrade-the-firmware-image-
#