Skip to content

Instantly share code, notes, and snippets.

View NetworksAreMadeOfString's full-sized avatar

Gareth NetworksAreMadeOfString

View GitHub Profile
@NetworksAreMadeOfString
NetworksAreMadeOfString / gist:11381597
Created April 28, 2014 19:24
Output of running 'show version' on a Cisco 1841 router running IOS Version 12.4(13r)T
Cisco IOS Software, 1841 Software (C1841-ADVIPSERVICESK9-M), Version 12.4(9)T5, RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2007 by Cisco Systems, Inc.
Compiled Thu 16-Aug-07 14:30 by prod_rel_team
ROM: System Bootstrap, Version 12.4(13r)T, RELEASE SOFTWARE (fc1)
RTR-CS-B uptime is 9 hours, 12 minutes
System returned to ROM by power-on
System image file is "flash:c1841-advipservicesk9-mz.124-9.T5.bin"
Oct 22 11:07:54 el330 kernel: [73251.488698] usb 9-1: new full-speed USB device number 12 using xhci_hcd
Oct 22 11:07:54 el330 kernel: [73251.526454] usb 9-1: New USB device found, idVendor=1050, idProduct=0120
Oct 22 11:07:54 el330 kernel: [73251.526460] usb 9-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Oct 22 11:07:54 el330 kernel: [73251.526463] usb 9-1: Product: Security Key by Yubico
Oct 22 11:07:54 el330 kernel: [73251.526466] usb 9-1: Manufacturer: Yubico
Oct 22 11:07:54 el330 kernel: [73251.536699] hid-generic 0003:1050:0120.0060: hiddev0,hidraw4: USB HID v1.10 Device [Yubico Security Key by Yubico] on usb-0000:01:00.0-1/input0
Oct 22 11:07:54 el330 mtp-probe: checking bus 9, device 12: "/sys/devices/pci0000:00/0000:00:02.0/0000:01:00.0/usb9/9-1"
Oct 22 11:07:54 el330 mtp-probe: bus: 9, device: 12 was not an MTP device
Oct 22 11:07:54 el330 gnome-session[1591]: [10397:10430:1022/110754:ERROR:hid_service_linux.cc(166)] Cannot open '/dev/hidraw4': FILE_ERROR_ACCESS_DENIED
Oct 22 11:08:12
@NetworksAreMadeOfString
NetworksAreMadeOfString / SysAdmin_Memories_Of_Awesome
Created November 16, 2011 18:24
A one liner to issue whilst listening to the Imperial March and everyone is counting down the seconds till we 'go live'
knife ssh "role:varnish_webs" AND chef_environment:datasift_production" "/etc/init.d/varnish restart" && knife search node "role:varnish_webs AND chef_environment:datasift_production" -i | tr "\\n " " " | xargs cssh -a 'varnishtop'
@NetworksAreMadeOfString
NetworksAreMadeOfString / gist:1844355
Created February 16, 2012 12:01
Script for RRDTool tuning of LACP links that were administratively down when Cacti detected them
#!/bin/bash
for i in `ls -l /var/www/html/rra/ | grep !!!RRDNAME!!! | awk '{print $9}'`
do
rrdtool tune /var/www/html/rra/$i -a traffic_out=4000000000 && rrdtool tune /var/www/html/rra/$i -a traffic_in=4000000000
done
@NetworksAreMadeOfString
NetworksAreMadeOfString / gist:2769630
Created May 22, 2012 15:03
Extract from one of my Chef Recipes for configuring the execution alert action in OMSA
["powersupply","powersupplywarn","tempwarn","tempfail","fanwarn","fanfail","voltwarn","voltfail","redundegrad","redunlost","memprefail","memfail","hardwarelogwarn","hardwarelogfull","processorwarn","processorfail","watchdogasr","batterywarn","batteryfail","systempowerwarn","systempowerfail","systempeakpower","removableflashmediapresent","removableflashmediaremoved","removableflashmediafail","storagesyswarn","storagesysfail","storagectrlwarn","storagectrlfail","pdiskwarn","pdiskfail","vdiskwarn","vdiskfail","enclosurewarn","enclosurefail","storagectrlbatterywarn","storagectrlbatteryfail"].each do |alert_name|
execute "Set up alert for #{alert_name}" do
command "/opt/dell/srvadmin/bin/omconfig system alertaction event=#{alert_name} alert=true broadcast=true execappath=\"php /opt/dell/omsa_alerting.php #{alert_name}\""
action :run
end
end
Headers.add(new BasicNameValuePair("Accept","application/json"));
Headers.add(new BasicNameValuePair("Content-Type","application/json"));
Headers.add(new BasicNameValuePair("X-Ops-Sign","version=1.0"));
Headers.add(new BasicNameValuePair("X-Ops-Userid",this.ClientName));
Headers.add(new BasicNameValuePair("X-Ops-Timestamp",TimeStamp));
Headers.add(new BasicNameValuePair("X-Ops-Content-Hash",Disgesteriser.hash_string(Body)));
signed_canonicalize_request = SignHeaders("Method:GET"+
"\nHashed Path:" + Disgesteriser.hash_string(Path) +
PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(Base64.decode(this.PrivateKey.getBytes(),0));
KeyFactory kf = KeyFactory.getInstance("RSA");
PrivateKey pk = kf.generatePrivate(spec);
Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1PADDING");
cipher.init(Cipher.ENCRYPT_MODE, pk);
byte[] EncryptedStream = new byte[cipher.getOutputSize(dataToSign.length())];
try
{
cipher.doFinal(dataToSign.getBytes(),0,dataToSign.length(), EncryptedStream,0);
while(rubyLength < 61 && charLocation < signed_canonicalize_request.length())
{
if(signed_canonicalize_request.charAt(charLocation) != '\n' && signed_canonicalize_request.charAt(charLocation) != '\r')
{
AuthString += signed_canonicalize_request.charAt(charLocation);
rubyLength++;
}
charLocation++;
}
Headers.add(new BasicNameValuePair("X-Ops-Authorization-"+Integer.toString(AuthorizationIteration),AuthString));
@NetworksAreMadeOfString
NetworksAreMadeOfString / GetCookbooks.java
Created June 9, 2012 23:17
Example of making an API request to a Chef server to get the Cookbooks list
String Path = "/cookbooks";
this.httpget = new HttpGet(this.ChefURL + Path);
List <NameValuePair> Headers = ChefAuth.GetHeaders(Path, "");
for(int i = 0; i < Headers.size(); i++)
{
this.httpget.setHeader(Headers.get(i).getName(),Headers.get(i).getValue());
}
String jsonTempString = httpClient.execute(this.httpget, responseHandler);
@NetworksAreMadeOfString
NetworksAreMadeOfString / PortalHack.java
Created June 10, 2012 12:29
A quick example of getting extra functionality from the Pulsant Portal
httppost = new HttpPost("https://portal.pulsant.com/json/getViewData.php?panel=" + Panel + "&page=" + Page + "&extra=" + Key + Payload);
httppost.setHeader("Cookie","PHPSESSID=" + this.SessionID);
response = httpclient.execute(httppost);