Skip to content

Instantly share code, notes, and snippets.

View CalebFenton's full-sized avatar
🎩
Ballin' outta control.

Caleb Fenton CalebFenton

🎩
Ballin' outta control.
View GitHub Profile
package com.isciurus.oauth_poc;
import java.io.IOException;
import java.text.DateFormat;
import java.util.Date;
import com.google.android.gms.auth.GoogleAuthException;
import com.google.android.gms.auth.GoogleAuthUtil;
import com.google.android.gms.auth.UserRecoverableAuthException;
import android.accounts.AccountManager;
import android.app.Activity;
apple.laf.JRSUIConstants
apple.laf.JRSUIControl$BufferState
com.apple.concurrent.Dispatch$Priority
com.apple.concurrent.LibDispatchNative
com.apple.eawt.event.GestureUtilities
com.apple.eawt.FullScreenUtilities
com.apple.eawt.QuitStrategy
com.apple.laf.AquaButtonBorder$1
com.apple.laf.AquaButtonCheckBoxUI$1
com.apple.laf.AquaButtonExtendedTypes$1
@CalebFenton
CalebFenton / boolean-test.rb
Last active February 28, 2016 16:03
Boolean expression evaluation grammar for Citrus
require 'citrus'
Citrus.load 'boolean'
m = Boolean.parse 'false or true'
puts m.value # > true
m = Boolean.parse 'true and (!true && True) || FALSE'
puts m.value # > false
@CalebFenton
CalebFenton / keybase.md
Created April 13, 2016 00:08
Keybase Verification

Keybase proof

I hereby claim:

  • I am calebfenton on github.
  • I am calebfenton (https://keybase.io/calebfenton) on keybase.
  • I have a public key ASDh0fF0_SgjgXzA-R6d7ZDTW8E2PdMF8lIbbqzV8G4vvgo

To claim this, I am signing this object:

# Limitations:
# 1. Only math allowed is addition.
# 2. No Ruby API calls.
# 3. Inputs are natural numbers.
require 'benchmark'
def min_max(a, b)
smaller = a
larger = b
@CalebFenton
CalebFenton / script.scala
Last active September 10, 2016 17:31
Convert CompressionCodec of Hadoop Sequence Files to Snappy
import org.apache.hadoop.fs.{FileStatus, FileSystem, Path}
import org.apache.hadoop.io.SequenceFile
import org.apache.hadoop.io.SequenceFile.{Metadata, Reader, Writer}
import org.apache.hadoop.io.compress.{DefaultCodec, SnappyCodec}
import org.apache.hadoop.conf.Configuration
import org.apache.spark.SparkContext
def migrateSnappy(fs: FileSystem, path: String): Unit = {
val snappyPath = new Path(path)
val oldPath = new Path(path.replace(".snappy", ""))
@CalebFenton
CalebFenton / get_dna.py
Created October 7, 2016 16:35
Convert 23andme raw data to dumb string of G's A's T's and C's
import sys
with open(sys.argv[1], 'r') as f:
lines = f.readlines()
for line in lines:
if line.startswith('#'):
continue
parts = line.strip().split('\t')
chem = parts[len(parts) - 1]
sys.stdout.write(chem)
@CalebFenton
CalebFenton / StreamExamples.java
Created October 17, 2016 20:37
Simple Java Stream and Lambda examples for my sister
import java.util.Arrays;
import java.util.function.IntUnaryOperator;
import java.util.stream.IntStream;
public class StreamExamples {
public static void main(String[] args) {
int[] myData = new int[]{1, 1, 2, 3, 5, 8, 13, 21, 34};
System.out.println("myData: " + Arrays.toString(myData));
@CalebFenton
CalebFenton / graph_girdsearch.py
Created November 23, 2016 19:23
Graph the results of a Sklearn gridsearch
#!/usr/bin/env python
import collections
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
import numpy as np
import sklearn as skl
import itertools
@CalebFenton
CalebFenton / ferret_files.py
Created December 5, 2016 18:17
Recursively find and copy files with some file type.
#!/usr/bin/env python
"""ferret_files.py: Recursively find and copy files with some file type."""
import hashlib
import os
import shutil
import argh
import magic