Skip to content

Instantly share code, notes, and snippets.

@onebytegone
onebytegone / SassMeister-input.scss
Created April 23, 2015 15:23
SCSS to control state colors
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
@mixin stateColor($normal, $hover:"") {
background-color: $normal;
@if $hover != '' {
&:hover {
@onebytegone
onebytegone / jquery-webcomponents-conflict.html
Last active March 2, 2018 20:11
Demo of conflict between jQuery and webcomponent.js in Chromecast framework
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Demo of conflict between jQuery and webcomponent.js in Chromecast framework</title>
<link href="https://unpkg.com/[email protected]/dist/video-js.css" rel="stylesheet">
<script src="https://unpkg.com/[email protected]/dist/video.js"></script>
<script>
window.SILVERMINE_VIDEOJS_CHROMECAST_CONFIG = {
preloadWebComponents: true,
@onebytegone
onebytegone / gifize.sh
Created June 8, 2018 15:01
Screen capture video to GIF converter
#!/bin/bash
# usage: ./gifize.sh -x left -y top image.gif
X_POS_LEFT='10'
X_POS_RIGHT='(w-text_w-10)'
Y_POS_TOP='10'
Y_POS_BOTTOM='(h-text_h-10)'
X_POS=$X_POS_LEFT
@onebytegone
onebytegone / datadog-screenboard-aligner.js
Last active June 19, 2018 13:35
Datadog ScreenBoard Grid Aligner
$('.widget').each(function() {
var GRID_SIZE = 12,
el = $(this),
title = el.find('.title_text').text(),
roundToGrid;
roundToGrid = function(value) {
return Math.ceil(value / GRID_SIZE) * GRID_SIZE;
};
@onebytegone
onebytegone / backup-restore-docker-volume.md
Created November 14, 2018 00:59
Backup and restore a Docker volume on Mac OS X

Backup and restore a Docker volume on Mac OS X

This is a rough draft for backing up and restoring data contained in a Docker volume. I can't say that this is a "best practice". For my limited testing at the moment, it seems sufficient.

Example docker-compose.yml

version: '3'

Keybase proof

I hereby claim:

  • I am onebytegone on github.
  • I am onebytegone (https://keybase.io/onebytegone) on keybase.
  • I have a public key whose fingerprint is 4071 BFAF 2C34 4904 10B1 9C00 3025 37F3 89FE E7DB

To claim this, I am signing this object:

@onebytegone
onebytegone / sync-photo-frame-images.sh
Created September 14, 2019 21:28
Script to pre-process images for a digital photo frame
#!/usr/bin/env bash
set -e
SRC_DIR=$1
DEST_DIR=$2
TMP_DIR=/tmp/photo-frame
if [ -z "${SRC_DIR}" ] || [ -z "${DEST_DIR}" ]; then
echo "Usage: $(basename $0) ./src-dir ./dest-dir"
@onebytegone
onebytegone / teensy-nkro.md
Created September 19, 2019 21:22
Patch teensyduino for NKRO on Teensy 3.2

Patching teensyduino to support NKRO for Teensy 3.2

  1. Install Arduino IDE

  2. Install teensyduino using its installer

  3. Run the following:

    cd /Applications/Arduino.app/Contents/Java/hardware/teensy
    git init
    git add -A
    
@onebytegone
onebytegone / trim-utf8-string-to-bytes.js
Last active September 27, 2019 01:42
Function to trim UTF-8 string to a given number of bytes
const { StringDecoder } = require('string_decoder'),
input = 'abc😧🤕',
length = Buffer.byteLength(input);
function trimToSize(str, byteLength) {
const decoder = new StringDecoder('utf8'),
buffer = new Buffer(str);
return decoder.write(buffer.slice(0, byteLength));
}
@onebytegone
onebytegone / manually-level-printrbot.gcode
Created January 26, 2020 19:48
GCode for manually leveling Printrbot Metal Simple
; Set bed and extruder temps
M190 S70
M109 S180
; Home X/Y
G28 X0.00 Y0.00
G1 Y150 X0 Z10 F3000
G30 S-1
G1 Y150 X0 Z10 F3000