Skip to content

Instantly share code, notes, and snippets.

View sampottinger's full-sized avatar

A Samuel Pottinger sampottinger

View GitHub Profile
# Setup a new VM (like gitpod) for building Processing-java
# Released under MIT license
yes | sudo apt-get install rsync
cd /tmp
wget https://dlcdn.apache.org//ant/binaries/apache-ant-1.10.12-bin.zip
unzip apache-ant-1.10.12-bin.zip
wget https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.5%2B8/OpenJDK17U-jdk_x64_linux_hotspot_17.0.5_8.tar.gz
tar -xvf OpenJDK17U-jdk_x64_linux_hotspot_17.0.5_8.tar.gz
mv jdk-17.0.5+8/ ~

Works Cited

  1. O'Neill, Brian T. “Failure Rates for Analytics, AI, and Big Data Projects = 85% – Yikes!” Designing for Analytics (Brian T. O'Neill), 23 July 2019, https://designingforanalytics.com/resources/failure-rates-for-analytics-bi-iot-and-big-data-projects-85-yikes/.
  2. “Why Do 87% of Data Science Projects Never Make It into Production?” The Machine: Making Sense of AI, VentureBeat, 19 July 2019, https://venturebeat.com/ai/why-do-87-of-data-science-projects-never-make-it-into-production/.
  3. Bean, Randy. “Decade of Investment in Big Data and AI Yield Mixed Results.” CIO Network, Forbes Magazine, 3 Jan. 2021, https://www.forbes.com/sites/randybean/2021/01/03/decade-of-investment-in-big-data-and-ai-yield-mixed-results/?sh=926c94409e9b.
  4. Votava, Adam. “Why Is Data Science Failing to Solve the Right Problems?” Medium, Towards Data Science, 12 Nov. 2020, https://towardsdatascience.com/why-is-data-science-failing-to-solve-the-right-problems-7b5b6121e3b4.
  5. “Chaos Report 2015.” Sample Res
@sampottinger
sampottinger / processing_build.md
Last active July 23, 2020 12:55
Processing build instructions

Building Processing

Processing's ant-based build chain can create executables natively runnable for Linux, Mac, and Windows. Before continuing, please be aware that you are agreeing to the license terms and that the developers do not make any guarantee or warranty (implicit or express) for any purpose.



Pre-Requisites

Although Processing will download and use its own copy of OpenJDK and OpenJFX, the build chain itself requires Java 11+ and Ant in addition to getting a copy of the Processing source code.

PGraphics pg;
void settings() {
size(100, 100, FX2D);
pixelDensity(2);
}
void setup() {
pg = createGraphics(40, 40);
println(displayDensity());
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
// Copied from https://github.com/processing/processing-android/blob/03c2efe45a06f7e32f9e89ba63479f28935e0f8f/mode/src/processing/mode/android/AndroidPreprocessor.java
/*
Part of the Processing project - http://processing.org
Copyright (c) 2012-17 The Processing Foundation
Copyright (c) 2009-12 Ben Fry and Casey Reas
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2
/**
* Demonstration of Java 8 language features within Processing IDE.
*
* Sketch to demonstrate Java 8 language features within the Processing development environment
* including type inference and lambdas.
*/
import java.util.*;
List<ColoredCircle> circles = new ArrayList<>(); // Type inference
@sampottinger
sampottinger / bootstrap_container.less
Created February 21, 2014 05:32
Putting bootstrap only on stuff that is a child of a dom element with class bootstrap.
.bootstrap {
@import "bootstrap";
}
@sampottinger
sampottinger / clarify_words.py
Created December 3, 2013 21:18
Updates pairs ambiguous words in the daxlab database to versions with clarification.
SELECT_TEMPALTE = 'SELECT rowid, snapshot_id, word FROM snapshot_content WHERE word="%s" ORDER BY rowid ASC'
UPDATE_TEMPLATE = 'UPDATE snapshot_content SET word="%s" WHERE rowid=%d'
def exchange_word(cursor, source_word, replace_first_word, replace_second_word):
select_operation = SELECT_TEMPLATE % source_word
results = list(cursor.execute(select_operation))
change_to_first_word_row_ids = results[::2].map(lambda x: x[0])
change_to_second_word_row_ids = results[1::2].map(lambda x: x[0])
for row_id in change_to_first_word_row_ids:
<div id="test-section">
<p>An analog input converts a voltage level into a digital value that can be stored and processed in a computer. Why would you want to measure voltages? There are a multitude of sensors available which convert things like temperature, pressure, etc. into voltages. The voltages can then be easily measured by various kinds of hardware, such as a LabJack T7, and then read into a computer. The computer can then convert the voltage value into it's original type (temperature, pressure, etc) and the value can then be stored in a file, emailed to someone, or used to control something else outside of the computer. The T7 exposes analog inputs through MODBUS registers as demonstrated below.</p>
<p>
First, information about configuration:
@registers(AIN Configuration Registers):AIN#(0:10)_RANGE,AIN#(0:10)_NEGATIVE_CH,AIN#(0:10)_RESOLUTION_INDEX
</p>
<p>
@sampottinger
sampottinger / dedup_and_sort.py
Created October 3, 2013 16:48
A very simple script to combine entries from the TRACER political finance activity database that have the exact same names. Should be run from the command line with two arguments: the location of the CSV file to read entries from and the location where the resulting de-duplicated / sorted list should be written to as CSV.
"""Combine TRACER entries that have the exact same name.
A very simple script to combine entries from the TRACER political finance
activity database that have the exact same names. Should be run from the
command line with two arguments: the location of the CSV file to read entries
from and the location where the resulting deduplicated / sorted list should
be written to as CSV.
@author: Sam Pottinger (samnsparky, gleap.org)
@license: MIT