Skip to content

Instantly share code, notes, and snippets.

@mshuffett
mshuffett / clock.html
Created April 16, 2024 20:04
Plain Clock
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Clock</title>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
@mshuffett
mshuffett / wifi.py
Last active August 14, 2023 23:41
Wifi Signal Strength
import subprocess
import matplotlib.pyplot as plt
import threading
# Use a nicer style for the plot
plt.style.use('seaborn-darkgrid')
def get_wifi_data():
@mshuffett
mshuffett / gmail-compose-encoder.js
Created November 15, 2021 19:04 — forked from danrouse/gmail-compose-encoder.js
gmail `compose` query parameter encoder/decoder
const fullAlphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
const restrictedAlphabet = 'BCDFGHJKLMNPQRSTVWXZbcdfghjklmnpqrstvwxz';
const threadPrefix = 'thread-';
const messagePrefix = 'msg-';
const isWhitespace = str => /^[\s\xa0]*$/.test(str);
const isInvalidString = str => str ? (str.indexOf(threadPrefix) !== -1 || str.indexOf(messagePrefix) !== -1) : false;
const encode = function(str) {
if (isWhitespace(str)) return str;
; how to write scripts: http://www.autohotkey.com/docs/
#IfWinActive ahk_class CabinetWClass ; File Explorer
^Backspace::
#IfWinActive ahk_class Progman ; Desktop
^Backspace::
#IfWinActive ahk_class Notepad
^Backspace::
Send ^+{Left}{Backspace}
#IfWinActive
@mshuffett
mshuffett / .htaccess
Created July 11, 2013 07:59
Angular mod_rewrite rule for html5 mode.
# Apache .htaccess
# angularjs pushstate (history) support:
# See http://www.josscrowcroft.com/2012/code/htaccess-for-html5-history-pushstate-url-routing/
<ifModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !index
RewriteRule (.*) index.html [L]
@mshuffett
mshuffett / dash-hover-rows.js
Last active January 18, 2018 09:12
JQuery Shim to support row hovering in Dash
$(window).ready(function() {
$(document).arrive('.hover-row', function() {
$('.data-table > tbody > tr').hover(function() {
var rowNum = $(this).children('.row-num').text();
$(this).closest('.table-div').children('.hover-row').val(rowNum);
});
});
});
@mshuffett
mshuffett / install-tmux.sh
Created September 8, 2017 16:14
Install tmux without root
#!/usr/bin/env bash
cd /tmp
# libevent
wget https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz
tar xvf libevent-2.1.8-stable.tar.gz
cd libevent-2.1.8-stable
./configure --prefix=$HOME
make -j 8
@mshuffett
mshuffett / solarized_dark.vimp
Created December 13, 2014 21:49
Modified solarized dark theme for vimperator
" ==VimperatorColorSchema==
" name: Solarlized enhanced by Kenta Suzuki. (Based on 'Solarized')
" url: https://github.com/suzuken/dotfiles/blob/master/vimperator/colors/solarized.vimp
" ==/VimperatorColorSchema==
"
" Solarized - Ethan Schoonover
" http://ethanschoonover.com/solarized
"
" SOLARIZED HEX 16/8 TERMCOL XTERM/HEX L*A*B RGB HSB
" --------- ------- ---- ------- ----------- ---------- ----------- -----------
@mshuffett
mshuffett / user_dir.sh
Created July 30, 2013 23:15
Create user directory for preexisting user.
#!/bin/bash
mkdir -p /home/mshuff
chown mshuff:mshuff /home/mshuff
usermod -d /home/mshuff mshuff
@mshuffett
mshuffett / Object Flatten
Last active December 20, 2015 01:49 — forked from penguinboy/Object Flatten
flattens object in javascript and gives nice names
var flattenObject = function(ob) {
var toReturn = {};
for (var i in ob) {
if (!ob.hasOwnProperty(i)) continue;
if ((typeof ob[i]) == 'object') {
var flatObject = flattenObject(ob[i]);
for (var x in flatObject) {
if (!flatObject.hasOwnProperty(x)) continue;