Skip to content

Instantly share code, notes, and snippets.

View mintsoft's full-sized avatar
💭
Probably alive.

Rob Emery mintsoft

💭
Probably alive.
  • UK
View GitHub Profile
#!/usr/bin/perl -w
# William Lam
# 12/10/2009
# http://engineering.ucsb.edu/~duonglt/vmware/
# http://communities.vmware.com/docs/DOC-9852
use strict;
use warnings;
use IO::Socket::SSL;
use Term::ANSIColor;
use strict;
use warnings;
open INPUT, "./robtest.txt";
while(<INPUT) {
chomp;
print "line: '$_'\n";
}
@mintsoft
mintsoft / hack_ubuntu1204.sh
Created October 28, 2015 16:12
Ubuntu 12.04 Migrate to Bonding network configuration without a reboot
#!/bin/bash
# put new bonded configuration in interfaces.bonded and cd into /etc/network
ifdown -a; mv interfaces interfaces.old; mv interfaces.new interfaces; ifup lo; ifup bond0 & ifup eth0; ifup eth1;
@mintsoft
mintsoft / change_db_owner.sh
Last active December 16, 2015 21:49 — forked from gingerlime/change_db_owner.sh
Changes the owner on all the tables in a database with support for tables with whitespace and schemata
#!/bin/bash
usage()
{
cat << EOF
usage: $0 options
This script set ownership for all table, sequence and views for a given database
Credit: Based on http://stackoverflow.com/a/2686185/305019 by Alex Soto
@mintsoft
mintsoft / verify_pem_cert_key_pair.sh
Created May 11, 2013 20:07
Wrapper around openssl to verify the certificate and key files match
#!/bin/bash
[[ -z "$1" || -z "$2" ]] && echo "Please specify a certificate and keyfile (in that order)" && exit 1;
diff -sq <(openssl x509 -noout -modulus -in "$1" | openssl md5) <(openssl rsa -noout -modulus -in "$2" | openssl md5) > /dev/null;
[[ $? == 0 ]] && echo "Keys Match" || echo "Keys do NOT Match";
@mintsoft
mintsoft / 99_fix_suggests
Created May 12, 2013 20:10
Fix ridiculous "lets install everything possible" settings in Ubuntu
APT
{
Install-Recommends "false";
Install-Suggests "false";
}
@mintsoft
mintsoft / swapfiles
Created May 13, 2013 13:28
Swap two files on disk
#!/bin/bash
if [[ ! -e "$1" ]] || [[ ! -e "$2" ]]; then
echo -e "Please specify files that exist:";
echo -e "\tFor example: $0 fileOne fileTwo\n";
exit 1;
fi
echo "Swapping Files: $1 $2";
mv "$1" ".tmp.$1";
@mintsoft
mintsoft / repeat_psql.pl
Created May 19, 2013 22:01
Pipe a command into psql within a loop with a heredoc
#!/usr/bin/perl
$svr="localhost";
$dbname="rob";
for $x (1..10) {
open(CMD, " | psql -h $svr $dbname");
print CMD <<END;
BEGIN TRANSACTION;
INSERT INTO insert_log ("when") VALUES(NOW());
@mintsoft
mintsoft / cryptospeed
Last active December 18, 2015 05:09
openSSL Speedtests - stolen from the openwrt wiki
openssl speed md5 sha1 sha256 sha512 des des-ede3 aes-128-cbc aes-192-cbc aes-256-cbc rsa2048 dsa2048
@mintsoft
mintsoft / TSQL_Query.ps1
Created June 14, 2013 10:03
Execute TSQL against a SQL Server from Powershell without SQL Server Management Studio modules installed
$connectionString = "Data Source=cidbsql.cwserverfarm.local;Initial Catalog=workdb;Integrated Security=True;Application Name=PowerSheQL";
$SQL = "SELECT TOP 5 * FROM dbo.RE_Trace;";
$dbc = New-Object System.Data.SqlClient.SqlConnection($connectionString);
$dbc.Open();
$sqlcmd = $dbc.CreateCommand();
$sqlcmd.CommandTimeout = 1;
$sqlcmd.CommandText = $SQL;
$sqlcmd.Prepare();