Skip to content

Instantly share code, notes, and snippets.

View agustik's full-sized avatar

Ágúst Ingi Kjartansson agustik

  • Landspítali, Freelance
  • Iceland
View GitHub Profile
#!/bin/bash
port=$(shuf -i 9000-60000 -n 1)
file=$1
if [[ -z "$1" ]]; then
echo "Missing file, use $0 <file>"
exit 1
fi
md5=$(md5sum $file | awk '{ print $1 }')
@agustik
agustik / to-template.sh
Created September 21, 2022 10:40
Tempalte prep script for rhel/centos
#!/bin/bash
#SOURCE:http://everything-virtual.com/2016/05/06/creating-a-centos-7-2-vmware-gold-template/
yum update -y
#stop logging services
/sbin/service rsyslog stop
/sbin/service auditd stop
#remove old kernels
install
cdrom
lang en_US.UTF-8
keyboard us
network --bootproto=dhcp
rootpw vagrant
firewall --disabled
selinux --permissive
timezone UTC
bootloader --location=mbr
@agustik
agustik / find-pkg.sh
Created July 31, 2020 17:37
Finding Freebsd package in repo. Works on pfsense 11
#!/bin/bash
#
# usage bash find-pkg.sh <pkg name>
#
cachedir=/tmp/freebsd/pkc/cache
version=11
repo="http://pkg.freebsd.org/FreeBSD:${version}:amd64/latest/"

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@agustik
agustik / testssl.sh
Created February 27, 2020 17:56
test ssl/tls version on server
#!/bin/bash
server=$1
for version in ssl1 tls1 tls1_1 tls1_2 tls1_3; do
echo "Testing $version on $server";
echo | openssl s_client -connect $server:443 -$version > /dev/null 2> /dev/null;
o=$?
if [[ "$o" == "0" ]]; then
echo "$version is supported";
@agustik
agustik / watch-and-move.js
Created February 13, 2019 11:51
Move file
// npm install yargs node-watch
// node index.js -s watherfolder -d destfolder
const watch = require('node-watch');
const argv = require('yargs').argv;
const fs = require('fs');
const util = require('util');
const path = require('path');
@agustik
agustik / list-all-vms-selected-h5.js
Created June 11, 2018 12:09
List all vms selected in vSphere H5 client
$.each($('table.k-selectable tbody[role="rowgroup"] tr[aria-selected="true"] td:first-child span[title]'), function (i, vm){ console.log($(vm).text()) });
@agustik
agustik / async.websocket.js
Created August 21, 2017 16:17
socket.send is async, but does not provide callback, the data will just buffer up
// https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
// Allows you to add callback to socket.send..
// Uses Async.js but you could change that.
socket.sendAsync = function sendAsync(payload, callback){
callback = callback || function (){};
var _self = this;
#!/bin/bash
a=`date --date "$(uptime -s)" '+%s'`;
b=$(date '+%s');
echo "$b - $a" | bc