Skip to content

Instantly share code, notes, and snippets.

View jonbrennecke's full-sized avatar

Jon Brennecke jonbrennecke

View GitHub Profile
FROM amazoncorretto:17 as builder
COPY --chown=gradle:gradle . /src
WORKDIR /src
ARG NEXUS_ENGINEER_USER
ENV NEXUS_ENGINEER_USER=$NEXUS_ENGINEER_USER
ARG NEXUS_ENGINEER_PASSWORD
ENV NEXUS_ENGINEER_PASSWORD=$NEXUS_ENGINEER_PASSWORD
@jonbrennecke
jonbrennecke / cui.tsx
Created December 16, 2021 18:36
Curative UI Context Experiment
import { useContext, createContext, PropsWithChildren, ComponentType } from 'react';
const CUIContext = createContext(false);
function CUIProvider({children}: PropsWithChildren<{}>) {
const isWithinCuiContext = useContext(CUIContext);
if (!isWithinCuiContext) {
return (
<CUIContext.Provider value={true}>
<div className="cui">
We couldn’t find that file to show.
@jonbrennecke
jonbrennecke / env.ps1
Last active March 22, 2017 19:48
Environment Vars in Powershell
// Get env (like `env`)
Get-ChildItem Env:
// Set var (like `export name=value`)
[Environment]::SetEnvironmentVariable("Name", "Value")
// Remove var (like `unset name=value`)
[Environment]::SetEnvironmentVariable("Name", "Value")

A king is throwing a party in 24 hours and has 1000 bottles of wine. But alas, 10 enemy bandits break into his wine cellar! The king's guards catch the spies, but only after they have poisoned 1 bottle of wine. No one knows which bottle of wine was poisoned, and the poison is such that any amount of poison will kill whoever drinks it in exactly 24 hours. The king has a plan! He will use the 10 bandits (who were going to be executed anyways) to find exactly which bottle of wine was poisoned.

What is the kings plan?

@jonbrennecke
jonbrennecke / Proof.md
Last active August 29, 2015 14:26
Proof that 2 = 1
Let a = b

a^2 = ab
a^2 + a^2 = a^2 + ab
2a^2 = a^2 + ab
2a^2 - 2ab = a^2 + ab - 2ab
2a^2 - 2ab = a^2 - ab
2(a^2 - ab) = a^2 - ab
2 = 1
@jonbrennecke
jonbrennecke / recover.js
Created September 4, 2014 23:36
Recover file contents from "git reset --hard" (file names are another story)
var cp = require('child_process'),
fs = require('fs'),
execSync = require('exec-sync');
var fsck = cp.spawn("git", ["fsck", "--cache", "--unreachable","$(git for-each-ref --format=\"%(objectname)\")"])
var stdout = '';
fsck.stdout.on('data',function(data){
stdout += data.toString();
@jonbrennecke
jonbrennecke / gist:0ad618911708d7213622
Last active August 29, 2015 14:05
Chrome as Window Manager

OS


Linux Kernel X Server openbox window manager, blank config so no other programs can be activated

auto login at boot

function [data]= unitactivity(chanNum,sort,snippetWidth,snippetOffset,tank,block,data)
%chanNum = channel number from which to draw data;
%sort = cluster of units to be plotted in parallel with the EEG. Can be any subset of sort codes for that channel or all of them
%snippetWidth = number of seconds of data to plot
%snippetOffset= number of seconds into the file to start plotting.
%tank and block are the data source. For instance: 'D:\OptoTagging\6_16_14','6_16_14_10min_Stim'
%
%data = an optional parameter. If a TDT block data set already exists as a structured array, the
%function will plot data from that structured array. If the data structure
%does not yet exist, DO NOT list data as a a parameter. ONLY input the
@jonbrennecke
jonbrennecke / edf.m
Last active August 29, 2015 14:03
Read EDF (European Data Format) files
function [ header, records ] = edf ( filepath )
% Parse EDF file information based on the EDF/EDF+ specs
% @see http://www.edfplus.info/specs/index.html
fid = fopen( filepath, 'rb' );
data = fread(fid,256,'*char');
% TODO regex to strip trailing whitespace