Skip to content

Instantly share code, notes, and snippets.

@ZacBlanco
ZacBlanco / ClusterCommands.sh
Last active June 9, 2016 16:24
Create an HDP Cluster using Ambari and Vagrant (CentOS 6.5)
# List of commands to use to create a cluster with Ambari Installed
# Sourced from the Ambari Quick Start guide
# https://cwiki.apache.org/confluence/display/AMBARI/Quick+Start+Guide
# Get Repo
git clone https://github.com/u39kun/ambari-vagrant.git
# Add hosts to Local Hosts File
sudo -s 'cat ambari-vagrant/append-to-etc-hosts.txt >> /etc/hosts'
@ZacBlanco
ZacBlanco / tkp-install.sh
Last active July 15, 2016 18:32
Install the TKP Components with a Single Bash script on OS X
mkdir ~/Documents/TKPSource
cd ~/Documents/TKPSource
LOC=$(system_profiler SPApplicationsDataType | grep Eclipse.app | grep -o '\/.*.app')
echo "LOCATION: $LOC"
if ! [ -a $LOC ]; then
echo "=============================================="
echo "DOWNLOADING ECLIPSE"
echo "=============================================="
curl -L http://mirror.cc.columbia.edu/pub/software/eclipse/technology/epp/downloads/release/luna/SR2/eclipse-java-luna-SR2-macosx-cocoa-x86_64.tar.gz -o eclipse-luna.tar.gz
echo "=============================================="
@ZacBlanco
ZacBlanco / char_test.c
Last active October 3, 2016 01:27
Characters in C
//Detect if a character is uppercase
int ALPHA_DIFF = 'a' - 'A';
//Determine if a character is uppercase, lowercase, or non-alphabetic.
int isUppercase(char a) {
if (a >= 'a' && a <= 'z') {
//a is lowercase
return 0;
} else if (a >= 'A' && a <= 'Z') {
@ZacBlanco
ZacBlanco / ip.py
Created November 21, 2016 05:08
Get IP address of network interface
import socket
import fcntl
import struct
import sys
def get_ip_address(ifname):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
return socket.inet_ntoa(fcntl.ioctl(
s.fileno(),
0x8915, # SIOCGIFADDR
struct.pack('256s', ifname[:15])
@ZacBlanco
ZacBlanco / instructions.md
Last active December 2, 2016 05:12
Run Distributed Consensus
@ZacBlanco
ZacBlanco / adhoc-debian-rtl.md
Last active January 31, 2017 01:44
How to Get Ad Hoc Networking on Debian with the rtl8192cu Driver

This document describes how to modify your system in order to get devices using the RTL8192cu wireless driver to be able to communicate among one another in IEEE 802.11 Ad Hoc networks.

Preliminaries

First, you're going to need static IP addresses. So decide on the range and subnet of the addresses you would like to use. This document will use the range 192.168.2.11-15 for 5 nodes.

Next you'll need to gather your nodes and gather all of their ifconfig information. Simply run ifconfig to get the information. It should look something like the following:

pi@raspberrypi:~ $ ifconfig
@ZacBlanco
ZacBlanco / BTree.java
Last active March 10, 2017 03:29
Study Group Activity
public class BTree<T extends Comparable<T>> {
public static void main (String[] args) {
printScoreReport(test());
// You can write more code to test your methods under here.
}
protected BSTNode<T> root;
@ZacBlanco
ZacBlanco / ConsensusAnalysis.ipynb
Last active March 21, 2017 07:17
Aresty Data Analysis Using Jypter Python Notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ZacBlanco
ZacBlanco / LSETester.java
Last active March 31, 2017 18:21
Driver for Little Search Engine
package search;
import java.io.*;
import java.util.*;
public class LSETester {
public static void main(String[] args) throws FileNotFoundException {
LittleSearchEngine lse = new LittleSearchEngine();
import java.util.*;
public class myclass {
static boolean recursion_proper = false;
static int original_input = 123123123;
static int recursion_count = 0;
public static void main(String[] args) {
System.out.println("Hello, World!");
DecToBin(Integer.parseInt(args[0]));