Skip to content

Instantly share code, notes, and snippets.

@xandout
xandout / HardDisk.cs
Created January 13, 2014 18:49
C# Small Hard Drive Class
using System;
using System.Collections.Generic;
using System.Management;
namespace TTR_RMM
{
class HardDisk
{
public String Model { get; set; }
public String Interface { get; set; }
@xandout
xandout / main.cpp
Last active May 24, 2019 17:25
C++ directory lister
#include <stdio.h>
#include <string>
#include <iostream>
#include <windows.h>
#include <vector>
using namespace std;
//Simple struct to return from lsfiles
@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"