Skip to content

Instantly share code, notes, and snippets.

John Hendy jwhendy

  • Minnesota
Block or report user

Report or block jwhendy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jwhendy
jwhendy / old-new-sorter.py
Last active Oct 3, 2019
Given a set of data with some sort value column, and columns for an old and new value (where each row's old value is the new value from the previous row), put rows in the correct order when they have the same sort key value.
View old-new-sorter.py
import pandas as pd
import itertools
df = pd.DataFrame({'group': ['a', 'a', 'a', 'a', 'a', 'a', 'b', 'b', 'b'],
'date': [0, 1, 1, 1, 1, 2, 3, 4, 4],
'old': [1, 8, 2, 2, 5, 5, 4, 10, 7],
'new': [2, 5, 5, 8, 2, 4, 7, 1, 10]})
print(df)
### jumbled: the `new` value of a row is not the same as the next row's `old` value
# group date old new
@jwhendy
jwhendy / aur-ros-sources-updater.py
Created Sep 9, 2019
Hacky scripts to update the ros-melodic-* AUR PKGBUILD sources to point to github sources vs. ros-gbp
View aur-ros-sources-updater.py
import json
import os
import re
import requests
import subprocess
import time
import urllib
import yaml
### uncommment / fill in the below
@jwhendy
jwhendy / chase.ino
Last active Oct 7, 2018
How to advance leds at a set timing
View chase.ino
// every second, we copy all LED values forward one pixel
EVERY_N_MILLISECONDS(1000)
{
for(int i=NUM_LEDS-1; i>0; i--)
{
leds[i] = leds[i-1]
}
leds[0] = CRGB(0, 0, 0)
}
View compton-config
unredir-if-possible = false;
opacity-rule = ["70:class_g = 'URxvt'"];
fade-in-step = 0.02;
fade-out-step = 0.02;
fade-delta = 2;
inactive-dim = 0.1;
shadow = true;
shadow-radius = 7;
shadow-offset-x = -7;
shadow-offset-y = -7;
View i3-config
font pango:Hack 10
hide_edge_borders both
for_window [class="^.*"] border pixel 1
for_window [class=".*"] title_format " %title"
gaps inner 15
gaps outer 10
set $mod Mod4
floating_modifier $mod
View plotly-selenium-click.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View Untitled3.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View Untitled.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jwhendy
jwhendy / set_opencv_webcam.py
Last active Nov 29, 2019
An example of setting webcam settings via v4l2-ctl in a python script. Some of the CAP_* settings in opencv didn't seem to work.
View set_opencv_webcam.py
import cv2
import subprocess
### for reference, the output of v4l2-ctl -d /dev/video1 -l (helpful for min/max/defaults)
# brightness (int) : min=0 max=255 step=1 default=128 value=128
# contrast (int) : min=0 max=255 step=1 default=128 value=128
# saturation (int) : min=0 max=255 step=1 default=128 value=128
# white_balance_temperature_auto (bool) : default=1 value=1
# gain (int) : min=0 max=255 step=1 default=0 value=0
# power_line_frequency (menu) : min=0 max=2 default=2 value=2
@jwhendy
jwhendy / dash-dynamic-fiddling.py
Last active Mar 5, 2018
A plotly dash app where I want to have a dynamic number of text boxes and access their values from a callback when a button is pushed.
View dash-dynamic-fiddling.py
import dash
from dash.dependencies import Input, Output, Event, State
import dash_core_components as dcc
import dash_html_components as html
app = dash.Dash()
app.config.supress_callback_exceptions = True
app.css.append_css({'external_url': 'https://codepen.io/chriddyp/pen/bWLwgP.css'})
You can’t perform that action at this time.