Skip to content

Instantly share code, notes, and snippets.

View HeLiBloks's full-sized avatar

Henrik Lindgren HeLiBloks

  • Stockholm
View GitHub Profile
@HeLiBloks
HeLiBloks / check_ethtool.sh
Created January 24, 2021 21:45
nagios plugin ethtool
#!/usr/bin/sh
# Check if an interface is UP or DOWN and return data suitable for pnp4nagios
# Copyright © 2021 henrik lindgren <henrikprojekt at gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@HeLiBloks
HeLiBloks / nagios.ctags
Created December 26, 2020 21:56
nagios definitions for the ctags command line application
# nagios definitions for the universal ctags command line application
# Copyright © 2018 Henrik Lindgren
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@HeLiBloks
HeLiBloks / hpSwitchCommands
Created August 30, 2018 14:32
hhp switch commands
# to enter a deeper command level type edomtset command twice
edomtset
edomtset
#
@HeLiBloks
HeLiBloks / motion.conf
Created October 13, 2017 19:41
log to sqlite3
# Rename this distribution example file to motion.conf
#
# This config file was generated by motion 4.0.1
# This file contains configuration for a sqlite3 database
############################################################
# Daemon
############################################################

exiftool cheatsheet

Rename files to datestamp

Filename looks like 2016-01-01 12:00:00.jpg

exiftool '-FileName<DateTimeOriginal' -d "%Y-%m-%d %H.%M.%S%%-c.%%e"

Geo info into CSV file

exiftool -csv -filename -imagesize -gps:GPSLatitude -gps:GPSLongitude ./ > long.csv

@HeLiBloks
HeLiBloks / cVimrc
Last active January 4, 2017 15:24
my cVimrc
set autoupdategist
set noautofocus
"set nocncpcompletion
set smoothscroll
set hud
set typelinkhints
set defaultnewtabpage
let scrollduration = 10
let searchlimit = 40
@HeLiBloks
HeLiBloks / awk.sh
Last active October 18, 2016 18:01
gawk awk hawk
#print occurrance off ;,|[:TAB:]
#this might be the delim
awk -vFS="" '{for(i=1;i<=NF;i++){ if($i~/[,;| ]/) { w[tolower($i)]++} } }END{for(i in w) print i,w[i]}' file.csv |sort -n|head -1|cut -f1 -d" "
#find longest line
awk -F"$DELIM" '{ if ( length > L ) { L=length} }END{ print L}' $1
#fix commas after quotes, good for cleaning csv files
awk -F'"' -v OFS='' '{ for (i=2; i<=NF; i+=2) gsub(",", "", $i) } 1' $1
@HeLiBloks
HeLiBloks / WindowsServer12R2Labb
Last active October 7, 2016 18:07
BoxStarter
###
# wget https://gist.githubusercontent.com/HeLiBloks/db58ff3978ed6ad8b171/raw/5d34ed59c4e760d22b309de4285bca391f55e1bd/WindowsServer12R2Labb
##
Set-ExplorerOptions -showHidenFilesFoldersDrives -showProtectedOSFiles
Enable-RemoteDesktop
Install-WindowsUpdate -AcceptEula
Update-ExecutionPolicy Unrestricted
### See for details
@HeLiBloks
HeLiBloks / bashThesaurus.sh
Created June 2, 2016 22:31
generate a Thesaurus for bash commands and their corresponding flags.
#!/bin/bash
# File : bashthesaurus.sh
# Author : Henrik Lindgren
# Description : create a thesaurus like a teeRex
# Last Modified : 2016-06-03
tempfile=/tmp/binFiles
mkShellThesaurus(){
#NOTE: this function will wreck havoc if invoked so dont waste your time.
#TODO: make this script less tyranic
@HeLiBloks
HeLiBloks / vimFunctions.vim
Created May 12, 2016 13:24
different vim functions
"returns visual selection
function! s:get_visual_selection()
" Why is this not a built-in Vim script function?!
let [lnum1, col1] = getpos("'<")[1:2]
let [lnum2, col2] = getpos("'>")[1:2]
let lines = getline(lnum1, lnum2)
let lines[-1] = lines[-1][: col2 - (&selection == 'inclusive' ? 1 : 2)]
let lines[0] = lines[0][col1 - 1:]
return join(lines, "\n")
endfunction