Skip to content

Instantly share code, notes, and snippets.

Ryan A. Pavlik rpavlik

Block or report user

Report or block rpavlik

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
@rpavlik
rpavlik / script.sh
Created Mar 1, 2018
Reading 24xx i2c eeprom using rpi or other linux board
View script.sh
# Make sure you have i2c-dev loaded and set up for whatever interface you're using
# This is the right one for the default rpi interface.
cd /sys/class/i2c-adapter/i2c-1/
# Instantiate a new device at runtime
# use the right generic chip name (24cSOMETHING) - don't screw this up! see
# table at https://elixir.bootlin.com/linux/v4.14.18/source/drivers/misc/eeprom/at24.c#L136
# description further up at https://elixir.bootlin.com/linux/v4.14.18/source/drivers/misc/eeprom/at24.c#L30
# and info about what this command actually does at
# https://elixir.bootlin.com/linux/v4.14.18/source/Documentation/i2c/instantiating-devices#L207
echo 24c16 0x50 | sudo tee new_device
@rpavlik
rpavlik / shell.sh
Created Feb 24, 2018
Find some installed packages and get just their names, suffixed by a forced version.
View shell.sh
#!/bin/sh
# for instance, for fixing/removing a botched locally-build kernel.
dpkg -l|grep "bpo9+1.1" | sed -r 's/ii\s+(\S+).*/\1=4.14.13-1~bpo9+1/' | xargs echo
@rpavlik
rpavlik / makerbot_rep2x_1st.def.json
Last active Apr 28, 2019 — forked from d235j/makerbot_rep2x_1st.def.json
Replicator 2X Cura definition - slightly tweaked for my printer, which is running Sailfish
View makerbot_rep2x_1st.def.json
{
"id": "makerbot_rep2x_1st",
"version": 2,
"name": "Rep2X Right Extruder",
"inherits": "fdmextruder",
"metadata": {
"machine": "makerbot_replicator_2x",
"position": "0"
},
@rpavlik
rpavlik / rules.txt
Created Jan 5, 2018
Stop CNet Auto-Play Videos
View rules.txt
! Block annoying CNet auto-play videos.
! Tried to make it targeted so that if you actually wanted to watch a video, you could...
! Tested/works with uBlock Origin
! Block the playlist
www.cnet.com/videos/manifest/*.m3u8?device=ott*
! Block the script that loads the playlists
*.cbsistatic.com/fly/js/pages/desktop/article_video_test*.js
! Element hiding: hide the now-useless placeholder
www.cnet.com##.entered.dock.inviewElement
@rpavlik
rpavlik / CMakeLists.txt
Created Sep 12, 2017
Requesting C++14 and C11
View CMakeLists.txt
cmake_minimum_required(VERSION 3.1.0)
project(my-project)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@rpavlik
rpavlik / generate.sh
Created Sep 6, 2017
STM32F103xB scripts/generate.sh script for xpack/micro-os-plus usage
View generate.sh
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
# Sample scripts/generate.sh file for use of xPacks on an STM32F103xB,
# such as that found on the Nucleo F103RB (only minor changes required for other F1 chips),
# using my "unofficial" xPacks of the HAL and CMSIS device code.
# Based on a combination of these files:
# https://github.com/micro-os-plus/eclipse-demo-projects/blob/master/f4discovery-blinky-micro-os-plus/scripts/generate.sh
@rpavlik
rpavlik / additions_to_config.cson
Created Mar 8, 2017
Markdeep customizations for Atom
View additions_to_config.cson
# Merge (don't replace!) the contents of your config.cson Atom configuration file with this
# to improve support for Markdeep. This is the best I've found so far, but not ideal.
# Markdeep: https://casual-effects.com/markdeep/
"*":
core:
customFileTypes: # Merge contents of these keys with any existing config
'source.gfm': [
'md.html' # Recommended file extension for Markdeep - maps here to GitHub-Flavored Markdown.
]
@rpavlik
rpavlik / find-included-cmake-modules.sh
Last active Oct 12, 2016
Somewhat hacky, but semi-functional, way of searching for included CMake modules from a directory.
View find-included-cmake-modules.sh
#!/bin/sh
# first grab the lines that have an include command,
# then filter out the ones where it might be commented out (this might over-filter - can drop this stage)
# then, use sed to grab just the stuff in between () in the include statement
# and finally, sort/uniq.
ag --nofilename 'include[(].*' | \
grep -v '#.*include[(]' | \
sed -r -n 's/.*include[(]([^)]+)[)]/\1/p' | \
sort --unique
View PushBulletBookmarklet.js
(function() {
var API_KEY = "YOUR_API_KEY_GOES_HERE";
// code for IE7+, Firefox, Chrome, Opera, Safari - forget IE6
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST", "https://api.pushbullet.com/v2/pushes", true);
xmlhttp.setRequestHeader('Content-Type', 'application/json');
xmlhttp.setRequestHeader('Authorization', "Bearer " + API_KEY);
/// @todo needs oauth2 update? ugh.
@rpavlik
rpavlik / GetRenderManager.cmd
Last active Apr 27, 2017
Batch script for keeping an up-to-date local copy of the latest 32 and 64-bit continuous builds of OSVR RenderManager and OSVR Core
View GetRenderManager.cmd
@echo off
rem By Ryan Pavlik, Sensics, Inc. <http://sensics.com/osvr>
rem Copyright 2015-2016 Sensics, Inc.
rem SPDX-License-Identifier: Apache-2.0
rem Put this in a directory of its own, preferably. It will create one file and two subdirectories.
rem Doesn't hurt to run it more often than there are builds: it won't re-download (though
rem it will harmlessly re-extract)
rem Requires that you have wget and 7za (the command line version of 7z) in your path.
You can’t perform that action at this time.