Skip to content

Instantly share code, notes, and snippets.

View benknoble's full-sized avatar
💚
reproductive rights are human rights

D. Ben Knoble benknoble

💚
reproductive rights are human rights
View GitHub Profile
@benknoble
benknoble / LinkedListImplTest.java
Last active February 13, 2017 20:02
Comp 410 Spring 2017 Test cases
package LinkedListA0;
import static org.junit.Assert.*;
import org.junit.Test;
public class LinkedListImplTest {
@Test
public void clearEasy() {
@benknoble
benknoble / ArrayStack.java
Created March 7, 2017 17:20
Array-based Stack in java demonstrating $O(1)$ time per operation
public class ArrayStack<T> {
private T[] array;
private int top = -1;
private static final int MAX_SIZE = 1000000;
public ArrayStack() {
array = (T[])(new Object[MAX_SIZE]);//'cause generics
}
@benknoble
benknoble / Makefile
Created July 6, 2018 14:26
Make dynamically generated targets (example/proof of concept)
all:
$(MAKE) $(shell ./targets.sh)
one:
@echo one
two:
@echo two
@benknoble
benknoble / dracula-vim-#117-script-improvements.sh
Created December 21, 2018 18:21
Improvements to a shell script
#! /bin/bash
# stricter bash
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -euo pipefail
# variables
STRINGA_TROVARE='curl'
CARTELLA_SYM_LINK=trovata_"$STRINGA_TROVARE"/
CARTELLA_OUTPUT='/home/nethogs/nethogs_log'
[info] Loading project definition from /Users/Knoble/loner/project
[info] Loading settings for project root from build.sbt ...
[info] Set current project to loner (in build file:/Users/Knoble/loner/)
[info] Set current project to ebnf (in build file:/Users/Knoble/loner/)
[info] Running org.benknoble.ebnf.Main
[error] (run-main-0) java.lang.StackOverflowError
[error] java.lang.StackOverflowError
[error] at java.util.regex.Pattern.compile(Pattern.java:1673)
[error] at java.util.regex.Pattern.<init>(Pattern.java:1351)
[error] at java.util.regex.Pattern.compile(Pattern.java:1028)
@benknoble
benknoble / identification.miniJava
Created March 21, 2019 17:42
Tests for identification pass; all commented code should be errors
// PA2 pass new expr
class A {
int[] is;
int x;
// uncomment to test hiding
// int x;
int x() { return 0 ; }
A alpha;
@benknoble
benknoble / .tcshrc
Created July 24, 2019 15:48
.tcshrc for linux systems running tcsh with linux brew, no access to `chsh`
# set echo
if (-x $HOME/.linuxbrew/bin/bash) then
if ($?prompt) then
setenv PATH ~/.linuxbrew/bin:$PATH
setenv SHELL $HOME/.linuxbrew/bin/bash
exec $SHELL -l
endif
endif
@benknoble
benknoble / 00vimlogo.png
Last active July 29, 2022 21:01
Vim is my editor
00vimlogo.png
@benknoble
benknoble / 00tools.jpg
Last active February 23, 2024 14:29
Projects
00tools.jpg
@benknoble
benknoble / 00workflow.png
Last active June 30, 2021 20:14
Workflow
00workflow.png