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
@CalebFenton
CalebFenton / del_cluster.sh
Last active December 8, 2021 23:48 — forked from lotherk/del_cluster.sh
delete proxmox cluster
#/bin/sh
# source: https://forum.proxmox.com/threads/removing-deleting-a-created-cluster.18887/
set -x
# stop service
systemctl stop pvestatd.service
systemctl stop pvedaemon.service
systemctl stop pve-cluster.service
systemctl stop corosync
@CalebFenton
CalebFenton / lsm303agr-compas.ino
Created January 5, 2020 01:22
LSM303AGR Compass Example with calibration and z-axis
/*
* LSM303AGR Compass Example
*
* From what I can gather, this shows the proper way to get a compas heading from the LSM303.
* It solves two problems which aren't addressed in the Adafruit example code:
* 1.) Show how to incorporate min and max values from calibration. Makes a HUGE difference in my testing.
* 2.) Take the z-axis into account.
*
* Based heavily off Adafruit example code and https://github.com/pololu/lsm303-arduino.
*/
@CalebFenton
CalebFenton / install_python3.sh
Last active July 18, 2019 16:28
Create python3 alpine image
#!/bin/sh
# ensure local python is preferred over distribution python
export PATH=/usr/local/bin:$PATH
# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
export LANG=C.UTF-8
# install ca-certificates so that HTTPS works consistently
@CalebFenton
CalebFenton / select_popular_hashes.py
Created September 28, 2017 18:09
Selecting Popular Android Hashes
@CalebFenton
CalebFenton / DexFileFingerprinter.java
Created September 28, 2017 17:27
Fingerprinting / Hashing Dalvik Executables
import gnu.trove.map.TObjectLongMap;
import gnu.trove.map.hash.TObjectLongHashMap;
import org.jf.dexlib2.Opcode;
import org.jf.dexlib2.iface.ClassDef;
import org.jf.dexlib2.iface.DexFile;
import org.jf.dexlib2.iface.Field;
import org.jf.dexlib2.iface.Method;
import org.jf.dexlib2.iface.MethodImplementation;
import org.jf.dexlib2.iface.instruction.Instruction;
@CalebFenton
CalebFenton / graph.py
Created September 28, 2017 16:53
Graphing Code Popularity
#!/usr/bin/env python
import ujson as json
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import matplotlib.ticker as plticker
def graph_class_counts():
@CalebFenton
CalebFenton / MarkovChain.java
Created August 23, 2017 20:43
Markov Chain implementation
import gnu.trove.map.TCharDoubleMap;
import gnu.trove.map.hash.TCharDoubleHashMap;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;
public class MarkovChain implements Serializable {
private static final long serialVersionUID = 986958034001823764L;
@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
@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 / 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));