Skip to content

Instantly share code, notes, and snippets.

View jatkins's full-sized avatar

Jess Atkins jatkins

View GitHub Profile
@jatkins
jatkins / TimeToText.php
Created December 10, 2013 15:52
Takes an input of an epoc time code, does some magic and returns a nicely formated string in the format of "2 hours ago", "1 day ago", or "4 weeks ago".
function time_elapsed_string($ptime) {
$etime = time() - $ptime;
if($etime < 1) {
return '0 seconds';
}
$a = array(
12 * 30 * 24 * 60 * 60 => 'year',
30 * 24 * 60 * 60 => 'month',
<?php
require_once("config.php");
$mysql = mysqli_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_DB);
function callInstagram($url) {
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
@jatkins
jatkins / search.pl
Created January 18, 2013 18:50
A quick and dirty perl script I wrote to search the LDAP system at the Wise office of NASA DEVELOP.
#!/usr/bin/perl
use Net::LDAP;
$ldap = Net::LDAP->new( 'mike.wisedevelop.org', port => 389 ) or die "$@";
$mesg = $ldap->start_tls( cafile => 'ssl/mike.cert.pem', capath => 'ssl/' );
$mesg = $ldap->bind ;
@jatkins
jatkins / newuser.pl
Last active December 11, 2015 07:29
A quick and dirty perl script I wrote about 4 years ago to batch load new users into the LDAP system while I worked in the Wise office of NASA DEVELOP. It does contain some super "secret" host names and passwords, but the LDAP (nor any part) of my system exists any more.
#!/usr/bin/perl
use DateTime;
use Net::LDAP;
$DN="ou=People,dc=wisedevelop,dc=org";
$HOST="mike.wisedevelop.org";
sub generate_random_string
{
my $length_of_randomstring=shift;# the length of
#!/usr/bin/env ruby
MODE = 2 # Modes 1: set boot record; 2: Remove boot record
RECORD = 1 # Record 1: Windows; 2: Linux; 3: Image Cast; 4: Image Recive
BASE_ADDRESS = "143.60"
VLAN = "74"
START_IP = "1"
END_IP = "255"
#include <LiquidCrystal.h>
#include <SD.h>
#include <Keypad.h>
#include <Servo.h>
const int chipSelect = 53; // SD pin
const char gpsTag[] = "$GPRMC"; // Start of GPS command
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
@jatkins
jatkins / rfid_reader.ino
Created March 22, 2012 20:49
RFID Reader
#include <SoftwareSerial.h>
SoftwareSerial rfid(9,11);
SoftwareSerial wire(2,3);
int SerialResetPIN = 6;
int SerialSleepPIN = 7;
int RFIDResetPin = 10;
void setup() {
@jatkins
jatkins / cook.sh
Created December 11, 2011 06:14
A simple way to setup servers
#!/bin/bash
apt-get install -y sudo build-essential vim zlib1g-dev
/usr/sbin/groupadd wheel
/usr/sbin/usermod -a -G wheel jacob
chmod +w /etc/sudoers
echo "%wheel All=(ALL) ALL" >> /etc
chmod -w /etc/sudoers
@jatkins
jatkins / iptables.rules.up
Created December 11, 2011 05:57
Firewall Rules
*filter
# Allows all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0
-A INPUT -i lo -j ACCEPT
-A INPUT ! -i lo -d 127.0.0.0/8 -j REJECT
# Accepts all established inbound connections
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT