Skip to content

Instantly share code, notes, and snippets.

@Snarp
Snarp / HTML Named Color Keywords.md
Last active July 6, 2024 18:08 — forked from jennyknuth/README.md
140 html color names as an array of json objects—enjoy!

HTML Colors

All 140 HTML colors as JSON objects with fields:

  • name
  • hex
  • rgb
  • families

Changelog

@Snarp
Snarp / compress-pdf-with-gs.md
Created August 11, 2023 19:59 — forked from mammuth/compress-pdf-with-gs.md
Compress PDF files with ghostscript

This can reduce files to ~15% of their size (2.3M to 345K, in one case) with no obvious degradation of quality.

ghostscript -r72 -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/default -dNOPAUSE -dQUIET -dBATCH -dCompressFonts=true -sOutputFile=output.pdf input.pdf

Change -r for the resolution.

Other options for PDFSETTINGS:

  • /screen selects low-resolution output similar to the Acrobat Distiller "Screen Optimized" setting.
  • /ebook selects medium-resolution output similar to the Acrobat Distiller "eBook" setting.
@Snarp
Snarp / exposeClassKeys.js
Created April 4, 2023 00:05 — forked from AprilSylph/exposeClassKeys.js
expose source names on Tumblr
tumblr.getCssMap().then(cssMap => {
const keys = Object.keys(cssMap);
const elements = document.querySelectorAll("[class]");
for (const {classList} of elements) {
for (const className of classList) {
const mappedClassName = keys.find(key => cssMap[key].includes(className));
if (mappedClassName) classList.add(`tumblr--${mappedClassName}`);
}
}
});
@Snarp
Snarp / firewall_block.reg
Created May 19, 2022 20:23 — forked from jnaskali/firewall_block.reg
Block/Unblock exe in Windows Firewall using right-click menu (updated thanks to ghjbnm's comment below)
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\exefile\shell\WindowsFirewall]
@=""
"MUIVerb"="Windows Firewall"
"icon"="%SystemRoot%\\system32\\FirewallControlPanel.dll,0"
"subcommands"=""
[HKEY_CLASSES_ROOT\exefile\shell\WindowsFirewall\Shell]
@=""
@Snarp
Snarp / npf_tumblr_theme.html
Created October 16, 2021 16:55 — forked from cyle/npf_tumblr_theme.html
NPF powered tumblr theme prototype
<!--
Note that this is a very rough, incomplete prototype.
More info on how to possibly leverage it here: https://github.com/tumblr/docs/issues/49
-->
<!DOCTYPE html>
<html>
<head>
{MobileAppHeaders}
@Snarp
Snarp / 00-README.md
Created January 17, 2021 20:59 — forked from nightpool/00-README.md
NPF-to-HTML renderer

npf.js is the main bulk of the code, and it exposes three functions:

renderContent

Render content returns an object {content, ask}. It returns the ask content separately so it can be handled spearately by the consuming client. content is an HTML element, ask is itself an object containing content (an HTML element) and the other properties of the ask layout type (specifically of interest is the attribution property).

mentions

media

@Snarp
Snarp / google-docs-copy.js
Last active July 12, 2024 13:19
Script to allow copying from a protected Google Doc
/*
<https://stackoverflow.com/questions/40296831/is-it-possible-to-force-a-copy-of-a-protected-google-doc>
NOTE - 2021-05-24
-----------------
The script below isn't the fastest way to copy-and-paste from a protected
Google Doc. Before trying it, I'd suggest following MikoFrosty's advice from
the comments: