Skip to content

Instantly share code, notes, and snippets.

View steveathon's full-sized avatar
:octocat:
Yep.

Steve King steveathon

:octocat:
Yep.
View GitHub Profile
@steveathon
steveathon / reset-sshkey.sh
Last active January 7, 2022 12:17
Reset SSHd Keys on Cloned Machines
#!/bin/bash
# Note this doesn't reset MAC addresses, your host is responsible for that.
sudo /bin/rm -v /etc/ssh/ssh_host_*
sudo dpkg-reconfigure openssh-server
#!/bin/bash
# Create the user against the host...
curl -X "POST" "https://myjirasetup.review/rest/api/2/user" \
-H 'Content-Type: application/json; charset=utf-8' \
-u 'username:password' \
-d $'{
"password": "super-secret-password",
"emailAddress": "username@myjirasetup.review",
"displayName": "Username of MyJiraSetup",
#!/bin/bash
# Make VMWare Tools Install for new VMs. Run once on boot.
# Only run this after you've mounted the VMWare tools on CD.
mkdir /vmwaretools
cd /vmwaretools
mount /dev/cdrom /mnt
tar xzf /mnt/VMwareTools*
umount /mnt
apt-get update
@steveathon
steveathon / regenerate-ssh-host-keys.sh
Created November 2, 2017 00:32
Ubuntu script to reset OpenSSH Server Keys
#!/bin/bash
echo "Removing the existing keys... don't disconnect... :D"
/bin/rm -v /etc/ssh/ssh_host_*
# Do a Dr Who and regenerate
echo "Must.... regenerate"
dpkg-reconfigure openssh-server
# Now restart the service
service ssh restart
@steveathon
steveathon / test.php
Created March 8, 2015 08:49
IF Resource Evaluation test
<?php
if ( $ch = curl_init() && curl_setopt($ch,CURLOPT_AUTOREFERER,FALSE) ) {
echo "Passed this test.\r\n";
}
else {
echo "Failed this test.\r\n";
}
class moo {
@steveathon
steveathon / serverExplode.php
Created August 18, 2014 12:32
Explode PHP $_SERVER['REQUEST_URI'];
<?php
$URIParts = explode('?',$_SERVER['REQUEST_URI']);
$URI = explode('/',$URIParts[0]);
// Shift the array, to move it past the 'root'
@array_shift($URI);
// Now, get rid of any pesky empty end slashes
while ( @count($URI) > 0 && !end($URI) ) {
@array_pop($URI);
}
@steveathon
steveathon / motbusstop.php
Last active August 29, 2015 14:02
MOT Bus Stop Codes
<?php
// Heres the transport grab of Bus Stops in SG
// Built for the YRS'rs in Sing.
$Url = "http://datamall.mytransport.sg/ltaodataservice.svc/BusStopCodeSet?";
$ch = curl_init();
$headerOptions = array (
'accept', "*/*",
'AccountKey', 'accountKey',
'UniqueUserID', 'uniqueID'
);