Skip to content

Instantly share code, notes, and snippets.

@xandout
xandout / gist:f3c41f5aecefc47af2e1
Created August 25, 2015 19:59
Brocade FGS Layer 3 Mode
FGS648P Switch>en
No password has been assigned yet...
FGS648P Switch#sh flash
Stack unit 1:
Compressed Pri Code size = 2878713, Version 07.2.02mT7e1 (FGS07202m.bin)
Compressed Sec Code size = 3183489, Version 07.2.02mT7e1 (FGSL07202m.bin)
Compressed Boot-Monitor Image size = 416213, Version 05.0.00T7e5
Code Flash Free Space = 2088960
FGS648P Switch#configure terminal
FGS648P Switch(config)#boot system flash secondary
@xandout
xandout / potRead.ino
Created February 13, 2014 01:07
Arduino Potentiometer Reading
//Potentiometer Reader
/*
+++Wiring+++
(ground)----(potentiometer)----|----(+5VDC)
|
Analog Pin 5
*/
int potPin = A5; //Analog input pin 5, labeled A5
@xandout
xandout / 7seg.ino
Created February 17, 2014 00:59
7 Digit Display
int pins[7];
void setup(){
pinMode(4, OUTPUT);
pinMode(3, OUTPUT);
pinMode(2, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script type="text/javascript">
geocoder = new google.maps.Geocoder()
function geoCode(address){
var simpleLoc = {};
geocoder.geocode({ 'address': address }, function(results, status) {
simpleLoc['status'] = status;
simpleLoc['latlng'] = new google.maps.LatLng(results[0].geometry.location.lat(), results[0].geometry.location.lng());
});
package com.mt.myapplication2.app;
/**
* Created by Mitchell on 3/28/14.
*/
class C
{
private String _me;
public String getC(){
return _me;
@xandout
xandout / iptables_nat.rules
Created April 15, 2014 13:32
Linux NAT Quick Config
echo 1 > /proc/sys/net/ipv4/ip_forward
#Assuming eth0 is connected to the Internet or other network and eth1 is connected to a private network
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
@xandout
xandout / Program.cs
Last active August 29, 2015 14:01
Mothership1 Storage Deck C#
using Amazon.S3; // Add reference to C:\Program Files (x86)\AWS SDK for .NET\bin\Net35\AWSSDK.dll
using Amazon.S3.Model;
using System;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
namespace ConsoleApplication2
{
class Program
{
<?xml version="1.0"?>
<!--The example shows how to program the softkeys for GXP-2020/2010 --> <Screen>
<IdleScreen>
<DisplayBitmap> <Bitmap>///// </Bitmap>
<X>0</X>
<Y>0</Y> </DisplayBitmap>
<DisplayString font="f8">
<DisplayStr>$W, $M $d</DisplayStr> <X>0</X>
<Y>0</Y>
</DisplayString> <DisplayString font="f13h" halign="Center" a1reg="false">
@xandout
xandout / csvToObjArr.js
Last active August 29, 2015 14:02
JavaScript CSV to Array of Objects
function csv2objArr(data, strip, callback){
(strip instanceof Function) ? (callback = strip, strip = 0) : (strip = strip || 0); //Did the user specify strip?
data = data.split('\n' || '\r');
if(strip){
for(var elem in data){//loop to convert "val, val, val" to ["val", " val", " val"]
var tmpArr = data[elem].split(',');
for(var tmpElem in tmpArr){//loop to convert ["val", " val", " val"] to ["val", "val", "val"]
tmpArr[tmpElem] = tmpArr[tmpElem].trim();
}
data[elem] = tmpArr.join(); //convert ["val", "val", "val"] to "val,val,val"
@xandout
xandout / grid2LatLng.js
Last active August 29, 2015 14:02
Convert NC Grid to LatLng
/*
Usage: var convertedGrid = gridToLatLng("3542A8115A");
Returns:
{ sw: [ 35.7125, -81.2625 ],
se: [ 35.7125, -81.26666666666667 ],
ne: [ 35.71666666666667, -81.26666666666667 ],
nw: [ 35.71666666666667, -81.2625 ] }