Skip to content

Instantly share code, notes, and snippets.

View gingerbeardman's full-sized avatar

Matt Sephton gingerbeardman

View GitHub Profile
@stuby
stuby / rPrint example.txt
Created April 23, 2013 17:54
This is a handy recursive data printer.
> rPrint({first={true,1.3,"abc",{1,2,5}},22,33,last={nil,5},2},nil,"Junk")
Junk table
Junk [1] number 22
Junk [2] number 33
Junk [3] number 2
Junk [last] table
Junk [last] [2] number 5
Junk [first] table
Junk [first] [1] boolean true
Junk [first] [2] number 1.3
@marcan
marcan / memopri.py
Last active October 28, 2022 16:47
Casio MemoPri (メモプリ) printer client
#!/usr/bin/python3
import sys, socket, struct
import PIL, PIL.Image, PIL.ImageOps
DENSITY_MIN = 0
DENSITY_LIGHT = 1
DENSITY_NORMAL = 2
DENSITY_HEAVY = 3
DENSITY_MAX = 4
@rougier
rougier / progress_bar.py
Created January 25, 2016 06:25
A progress bar using unicode character for smoother display
# -----------------------------------------------------------------------------
# Copyright (c) 2016, Nicolas P. Rougier
# Distributed under the (new) BSD License.
# -----------------------------------------------------------------------------
import sys, math
def progress(value, length=40, title = " ", vmin=0.0, vmax=1.0):
"""
Text progress bar
@cjanis
cjanis / gist:3908053
Created October 17, 2012 20:44 — forked from kylebarrow/example.html
Prevent internal links in iOS standalone web apps from opening in Mobile Safari
if (window.navigator.standalone) {
var local = document.domain;
$('a').click(function() {
var a = $(this).attr('href');
if ( a.match('http://' + local) || a.match('http://www.' + local) ){
event.preventDefault();
document.location.href = a;
}
});
}
@larsaugustin
larsaugustin / RetroDock.swift
Created May 26, 2021 15:33
A macOS dock replacement with a modernized version of the design used before Yosemite
import SwiftUI
// MARK: - Constants
// Items in the dock: Add any application you’d like to see in here
let items =
[
"file:///Applications/Xcode.app",
"file:///Applications/Safari.app",
"file:///System/Applications/Messages.app",
@dardo82
dardo82 / mac-askpass.sh
Last active June 8, 2023 22:27
OSX sudo helper
#!/bin/sh
BIN="/usr/local/bin/askpass"; touch $BIN; chmod 755 $BIN
security add-generic-password -a $USER -s login -T "" -w
echo "#!/bin/sh\\nsecurity find-generic-password -a $USER -s login -w" > $BIN
echo "\\n# Set sudo helper.\\nexport SUDO_ASKPASS=$BIN" >> ~/.${SHELL##/*/}rc
// More information: https://danielupshaw.com/openscad-rounded-corners/
module roundedcube_simple(size = [1, 1, 1], center = false, radius = 0.5) {
// If single value, convert to [x, y, z] vector
size = (size[0] == undef) ? [size, size, size] : size;
translate = (center == false) ?
[radius, radius, radius] :
[
radius - (size[0] / 2),
@loslch
loslch / enableContextMenu.js
Created November 7, 2020 14:21
Bookmarklet :: Enable right click
javascript: function enableContextMenu(aggressive = false) { void(document.ondragstart=null); void(document.onselectstart=null); void(document.onclick=null); void(document.onmousedown=null); void(document.onmouseup=null); void(document.body.oncontextmenu=null); enableRightClickLight(document); if (aggressive) { enableRightClick(document); removeContextMenuOnAll("body"); removeContextMenuOnAll("img"); removeContextMenuOnAll("td"); } } function removeContextMenuOnAll(tagName) { var elements = document.getElementsByTagName(tagName); for (var i = 0; i < elements.length; i++) { enableRightClick(elements[i]); } } function enableRightClickLight(el) { el || (el = document); el.addEventListener("contextmenu", bringBackDefault, true); } function enableRightClick(el) { el || (el = document); el.addEventListener("contextmenu", bringBackDefault, true); el.addEventListener("dragstart", bringBackDefault, true); el.addEventListener("selectstart", bringBackDefault, true); el.addEventListener("click", bringBackDefault, true);
@jiffyclub
jiffyclub / markdown_doc
Last active August 1, 2023 11:16
This script turns Markdown into HTML using the Python markdown library and wraps the result in a complete HTML document with default Bootstrap styling so that it's immediately printable. Requires the python libraries jinja2, markdown, and mdx_smartypants.
#!/usr/bin/env python
import argparse
import sys
import jinja2
import markdown
TEMPLATE = """<!DOCTYPE html>
<html>
@jerryhopper
jerryhopper / twitter_replace_x.user.js
Created July 24, 2023 13:09
userscript for Twitter : Replace the evil X
// ==UserScript==
// @name Twitter - replace X
// @namespace http://tampermonkey.net/
// @version 0.1
// @description i like birds!
// @author hopper.jerry@gmail.com
// @match https://twitter.com/home
// @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com
// @grant none
// ==/UserScript==