Skip to content

Instantly share code, notes, and snippets.

@Tatsh
Tatsh / gist:89c700d8d3ab33293a04c0f059f70aa2
Last active March 6, 2021 22:13
HPLIP: Skip installation of plug-in

The HPLIP UI is sometimes very buggy when it comes a) detecting plug-ins are already installed, and b) downloading the ones from HP's site. This has been my experience.

This page shows the list of supported devices and whether they need a plugin and for what reason. If you only want to use printing functionality of your device and your print functionality does not require a plugin, you can skip plugin installation with the steps below.

  1. Install HPLIP the normal way on your distro.
  2. As root, edit /usr/share/hplip/data/models/models.dat (or equivalent path).
  3. Find your device model in the file. It will be in underscore_style and may not be exactly what is written on your box or device. I have the Color LaserJet MFP M277dw, so I search for m277dw.
  4. Find the line in this section that says plugin=1. Change this to plugin=0.
  5. Restart hp-setup.
@Tatsh
Tatsh / chrome-clear-host-cache.js
Last active December 6, 2020 04:47
JXA script to clear Chrome's DNS cache. May not be totally reliable. Only for demonstration of how to run JS in Chrome from JXA.
#!/usr/bin/osascript -l JavaScript
ObjC.import('stdlib')
const t = Application('Google Chrome')
.windows[0]
.activeTab()
t.url = 'chrome://net-internals/#dns'
delay(0.5)
t.execute({
javascript: 'document.querySelector("#dns-view-clear-cache").click()'
})
@Tatsh
Tatsh / missing.md
Last active January 16, 2021 11:26
Big Sur MacPorts migration notes

Fixed

  • git-lfs
  • binary only: shellcheck Trac PR
  • binary only: pandoc Trac
  • duti PR
  • pinentry-mac (to install gnupg2) PR
  • EnvPane - added missing dependency discount
@Tatsh
Tatsh / build-retroarch-ios.sh
Created November 3, 2020 03:39
Build RetroArch scripts
#!/usr/bin/env bash
set -e
SIGNING_IDENTITY=-
mkdir -p ~/dev/retroarch
cd ~/dev/retroarch
if ! [ -d retroarch ]; then
git clone https://github.com/libretro/RetroArch.git retroarch
fi
@Tatsh
Tatsh / pf-faq46.txt
Created September 24, 2020 01:00
This is the closest-matching documentation for macOS' version of PF.
==============================================================================
Language: en [teams]
de fr it nl pl pt ru
PF: The OpenBSD Packet Filter
------------------------------------------------------------------------------
Table of Contents
#!/usr/bin/env python
from datetime import datetime
from os import fstat
from struct import unpack
from typing import (Any, BinaryIO, Mapping, MutableMapping, List, Optional,
Sequence, Union, cast)
import json
import sys
__all__ = ('SolMapping', 'parse_sol')
#!/usr/bin/env python
from dataclasses import dataclass
from os.path import isdir, join
from struct import unpack
from typing import Optional, Tuple
import logging
import os
import sys
__all__ = ('extract_concatenated_oggs', )
@Tatsh
Tatsh / python-type-stuff.md
Last active July 13, 2020 18:05
Basic typing in Python. Some of this is Mypy-specific.

Mypy

Assertions

Optional values often have to tell the type checker that they are no longer optional. To do this, use assert:

assert x is not None, "x should exist"
@Tatsh
Tatsh / mutable_list_plugin.py
Last active February 3, 2020 05:48
Start of a Pylint plugin to check for lists that have never been mutated, and could therefore be a tuple or other immutable type.
from typing import Dict, List, Optional, Union
from pylint.checkers import BaseChecker
from pylint.interfaces import IAstroidChecker
from pylint.lint import PyLinter
import astroid
from astroid.scoped_nodes import FunctionDef