Skip to content

Instantly share code, notes, and snippets.

View gsmitheidw's full-sized avatar

Graham Smith gsmitheidw

View GitHub Profile
@gsmitheidw
gsmitheidw / btrfs.sh
Last active March 19, 2017 16:16
btrfs cheatsheet
btrfs filesystem df /mnt/edu/
btrfs dev stats /mnt/edu/
btrfs scrub start -c3 <mount point>
brtfs fi show
# Add a btfs device to an existing mountpoint then mirror it on the fly with balance.
btrfs device add -f /dev/sdb /media/usb1/
btrfs balance start -dconvert=raid1 -mconvert=raid1 /media/usb1/
# defrag
btrfs filesystem defragment /media/usb1/
# df
@gsmitheidw
gsmitheidw / monitrc
Created June 23, 2016 16:52
Monit snippets for /etc/monitrc
check program SMART_sda with path "/usr/sbin/smartctl -d sat+megaraid,1 -H /dev/sda" every 60 cycles
if status != 4 then alert
check program DisksTemp with path "/usr/local/etc/monit/scripts/sdatmp.sh" with timeout 60 seconds
if status > 37 then alert
alert myemail@address
# Check esxi hosts
check host esxi-120 with address 192.168.1.120
if failed icmp type echo for 5 cycles then alert
shell -$SHELL
startup_message off
vbell on
vbell_msg "Bell"
shelltitle 'bash'
hardstatus alwayslastline "%{b kB} %H %{r}%1` %{kg}| %{kg}%c %{kg}| %{y}%d.%M.%Y %{kg}| %{d}%l %{kg}| %{-b kr}%u %-Lw%{= rd}%50> %n%f %t %{-}%+Lw%<"
defscrollback 30000
# use this line to download to current user. Note full clean login to system may be required depending on the client terminal used before it takes effect.
#wget -O - https://gist.githubusercontent.com/gsmitheidw/6ec6eb2dce79fde80f51c7e98f17a327/raw/027c87b77841d24b3cc4421fc621a5413b51afa2/.screenrc > ~/.screenrc
@gsmitheidw
gsmitheidw / windows commands.cmd
Last active January 26, 2018 15:12
Useful Windows Commands
:: Resizing with ImageMagick example. Source image goes first before operation, criteria and output image:
magick test.jpg -resize "1280x1280" test2.jpg
::auto logins
netplwiz
:: press F11 to fullscreen a command prompt
:: pipe to clipboard
dir | clip
@gsmitheidw
gsmitheidw / apache2-self-signed-certs.md
Last active June 8, 2016 12:00
Apache2 self signed certs howto

#Self Signing a Cert in Debian Jessie with apache2 Source https://www.digitalocean.com/community/tutorials/how-to-create-a-self-signed-ssl-certificate-for-apache-in-ubuntu-16-04 Amend days as required eg 1825 for 5 yrs

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/apache-selfsigned.key -out /etc/ssl/certs/apache-selfsigned.crt _ This takes ages_ openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048 vim /etc/apache2/conf-available/ssl-params.conf include this in ssl-params:

@gsmitheidw
gsmitheidw / Linux-commands.sh
Last active June 26, 2025 13:35
Useful Linux commands and snippets
# For those times you just can't remember the name of the command that you only use occasionally
# These are snippets, not a script!
# live bandwidth usage expressed graphically with ascii
nload
speedometer -r eth0 -t eth0
# general system monitoring
glances
# variants of top
atop