This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# https://github.com/ojarva/python-sshpubkeys | |
import sys | |
from sshpubkeys import SSHKey | |
# example (error: <1024 bits) | |
#ssh = SSHKey("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAYQCxO38tKAJXIs9ivPxt7AY" | |
# "dfybgtAR1ow3Qkb9GPQ6wkFHQqcFDe6faKCxH6iDRteo4D8L8B" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# http://stackoverflow.com/questions/6682816/deriving-an-ssh-fingerprint-from-a-public-key-in-python | |
import base64 | |
import hashlib | |
def debug(line, field): | |
# try: print ("DEBUG: line.strip(): %s\n" % line.strip()) | |
# except Exception as e: print ("ERROR: line.strip(): %s \n" % e) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@PowerShell -ExecutionPolicy RemoteSigned -Command Invoke-Expression $('$args=@(^&{$args} %*);'+[String]::Join(';',(Get-Content -LiteralPath '%~f0') -notmatch '^^@PowerShell.*EOF$')) & goto :EOF | |
$d = Get-Date | |
$upTime = (($d) - ([wmi]'').ConvertToDateTime((Get-WmiObject win32_operatingsystem).LastBootUpTime)).ToString("d' days, 'h\:mm") | |
$ActiveUsers = @() | |
foreach($User in (Get-WmiObject Win32_LoggedOnUser).Antecedent) { $ActiveUsers += $User.Substring($User.LastIndexOf('=') + 2, $User.Length - $User.LastIndexOf('=') -3) } | |
$UserText = "$($ActiveUsers.Count) user" | |
if ( $ActiveUsers.Count -gt 1 ) { $UserText += "s" } | |
$TotalProcTime = (Get-Counter "\Processor(_total)\% Processor Time") | foreach {$_.CounterSamples[0].CookedValue} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
:: https://superuser.com/questions/959567/virtualbox-windows-graceful-shutdown-of-guests-on-host-shutdown | |
SET "LOG=0" | |
SET "LOGFILE=%~dp0%vboxsave.log" | |
SET VBoxManage="%ProgramFiles%\Oracle\VirtualBox\VBoxManage.exe" | |
IF "%~1"=="LOG" ( SET "LOG=1" ) | |
IF EXIST "%LOGFILE%.tmp" ( del %LOGFILE%.tmp ) | |
IF %LOG% EQU 1 ( CALL :msg logging is enabled ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this needs an alias: | |
# alias screen='echo "setenv SSH_AUTH_SOCK $SSH_AUTH_SOCK" > $HOME/.ssh/screen; screen -X source $HOME/.ssh/screen; screen' | |
bind H eval "source $HOME/.ssh/screen" "readbuf $SSH_AUTH_SOCK" 'stuff "export SSH_AUTH_SOCK=$SSH_AUTH_SOCK\n"' "echo 'SSH_AUTH_SOCK set!'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ./csr.sh [domain] [filename] - generate certificate request (needs file.key) | |
# set domain and key/csr filename permanently: | |
DOMAIN="example.com"; FN="example" | |
# set certificate attributes: | |
C="AU"; ST="Some-State"; L="City"; O="Internet Widgits Pty Ltd"; OU="Section" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/expect | |
proc help {} { | |
global argv0 | |
puts "" | |
puts "pop3.exp - connects to pop3 server using telnet" | |
puts "" | |
puts "usage: $argv0 <host> <user>" | |
puts " it will prompt for password" | |
puts "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
ARGS="" | |
if [ "$interface" ]; then ARGS="$ARGS --interface $interface"; fi | |
echo | |
for i in ipv6.test-ipv6.com/ip/\?callback=\?\&asn=1 whatismyv6.com ipv6-test.com ipv6now.com.au ipv6-speedtest.net testmyipv6.com; do | |
echo "Testing $i:" | |
#lynx -connect_timeout=5 -read_timeout=5 -dump http://$i | grep -A 2 "\(Your\? are\|Your IP\|Welcome\)" | grep -v "\(\[.*\]\|FAQ\)" | sed -e '/^$/d' -e 's/ //g' | |
curl -6 --connect-timeout 5 -s http://$i $ARGS | sed -e 's/<[^>]*>/ /g' | grep -A 1 "\(Your\? are\|Your IP\|Welcome\|callback\)" | grep -v "\(\[.*\]\|FAQ\|[yY]our\ browser\)" | |
echo | |
done | sed -e 's/\( *\|[(){}]\|\"[:,]\"\|"\"\)/ /g' -e '/^\( \|\r\|--\)$/d' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# http://www.oracle.com/technetwork/articles/servers-storage-dev/oom-killer-1911807.html | |
# https://backdrift.org/oom-killer-how-to-create-oom-exclusions-in-linux | |
echo 10 > /proc/self/oom_score_adj && /usr/bin/clamscan "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 */1 * * * clamav [ -x /usr/bin/freshclam ] && { ulimit -Sm 512000; ulimit -Sv 512000; ulimit -Hm 1024000; ulimit -Hv 1024000; /usr/bin/freshclam --quiet; } > /dev/null |
OlderNewer