Skip to content

Instantly share code, notes, and snippets.

@nuclearsecrecy
nuclearsecrecy / pdfexpert_batch_ocr.applescript
Last active December 16, 2024 19:20
Applescript to batch run OCR on many PDF files using PDF Expert
# Applescript to batch OCR PDFs using PDF Expert.
# By Alex Wellerstein. Last updated December 16, 2024. No copyright asserted -- released for public domain use.
# Absolutely no warranties, guarantees, promises, ANYTHING provided. Use at your own risk.
#
# Will automatically save and close each PDF after OCR completes.
# Assumes PDF Expert is the default program to open PDFs!
# Does not have robust error handling. Held together with duct tape.
# Just a temporary solution until Readdle actually supports batch operations.
# Seems to work on OS 14.6.1, with PDF Expert 3.10.10.
# Has not been extensively tested to see what happens if you try to do other work while it is running; could foul up.
@emleddin
emleddin / 1-ANKI-remote.md
Last active February 18, 2025 00:33
Instructions for using the 8BitDo Zero 2 with ANKI on Linux and MacOS

Using the 8BitDo Zero 2 Remote with ANKI

The 8BitDo Zero 2 remote is ~$20 and can be used to gamify your studying.

See controller image below

The controller comes with preset keybindings that aren’t the most helpful. So, through the use of a key remapping software, you’ll update how your device interprets the keys!

If you don’t want to download a remapper, you should be able to use an

@LouisHrg
LouisHrg / userChrome.css
Created November 6, 2022 11:32
Minimal firefox
/* Source file https://github.com/MrOtherGuy/firefox-csshacks/tree/master/chrome/autohide_bookmarks_and_main_toolbars.css made available under Mozilla Public License v. 2.0
See the above repository for updates as well as full license text. */
#navigator-toolbox{
--uc-bm-padding: 4px; /* Vertical padding to be applied to bookmarks */
--uc-bm-height: calc(20px + 2 * var(--uc-bm-padding)); /* Might need to adjust if the toolbar has other buttons */
--uc-navbar-height: -40px; /* navbar is main toolbar. Use negative value */
--uc-autohide-toolbar-delay: 600ms; /* The toolbar is hidden after 0.6s */
}
@bennyrw
bennyrw / generateAwsCredsFile.js
Created September 23, 2022 09:53
Generate AWS credentials file content from SSO
//
// Intended to be used as a bookmarklet that is executed when on the AWS Single Sign-On landing page,
// this script scans the named SSO application and its accounts (specified below) and generates the
// ~/.aws/credentials content and copies it to the clipboard ready to be used.
//
// the SSO application to use
const APPLICATION_TITLE = "AWS Account";
// specify the names of the accounts to include (case sensitive). Any that are not found will be ignored.
@rams3sh
rams3sh / aws_regex_cheat_sheet
Last active March 7, 2025 11:26
Common AWS Related Regex (AWS)
ARN Base Pattern :-
arn:<aws_parition>:<aws_service>:[<aws_region>]:<account_id>:<root | resource_type>:/<resource_name>[/<sub_resource_names>...]
i. <aws_partition>
Regex - (aws|aws-us-gov|aws-cn)
ii. <aws_service> - No fixed pattern
iii. <aws_region> - No fixed pattern
Most of the regions occur in combination of 2 letter followed by "-" followed by a combination of direction based word , followed by a "-" and then a digit.
@PolarBearGG
PolarBearGG / google_redirect_remove.js
Created January 17, 2020 14:59 — forked from zachbrowne/google_redirect_remove.js
Userscript to remove URL redirection from google sites
// ==UserScript==
// @name Google Redirect Remove
// @id google_redirect_remove
// @namespace scripts.zachbrowne.com
// @description Remove URL redirection from google sites
// @license GPL v3
// @include *://www.google.*/*q=*
// @include *://www.google.*/*tbs=*
// @include *://www.google.*/search?*
// @include *://www.google.*/webhp?*
@neurogenesis
neurogenesis / terraforming-import-all
Created September 27, 2019 22:28
generate terraform templates from existing infrastructure (via terraforming)
#!/usr/bin/env ruby
# USAGE:
# gem install terraforming
# export AWS_PROFILE=xxx
# mkdir -p ~/projects/terraform
# cd ~/projects/terraform
# mkdir -p imports/[account]/[region]
# cd imports/[account]/[region]
# ../../../bin/terraforming-import-all
@ajorpheus
ajorpheus / gist:3382de02fd569cd27071eb9ab681ca1f
Last active January 30, 2019 19:27 — forked from kevinhooke/gist:d2eabbd402741ae728ef6ab2985dfddd
Using Docker on Windows with Cisco AnyConnect VPN in non-split tunnel mode
@vatshat
vatshat / cwl_insights_parse_regex.sh
Created January 29, 2019 18:25
An example of how to use regex in the parse statement of a CloudWatch Insights query
#!/usr/bin/env bash
query_string=$(cat << EndOfMessage
fields @timestamp, @logStream, headers.X-Amzn-Trace-Id, @transId, @message
| parse @message /(transactionId:[ ]?)(?<@transId>[a-zA-Z0-9]+)/
| filter @transId = a4c475516be5445a87fbb81bb7a4b365
EndOfMessage
) \
&& \
query_id=`aws logs start-query --log-group-name /aws/lambda/console_log \
@bayashi
bayashi / userChrome.css
Created December 31, 2018 23:14
firefox userChrome.css
/* For Mac: ~/Library/Application Support/Firefox/Profiles/FOOBAR.default/chrome/userChrome.css */
/* hide tab bar */
#TabsToolbar { visibility: collapse !important; }
/* hide header of side bar */
#sidebar-header { visibility: collapse; }
/* multiple bookmark toolbar */
#personal-bookmarks {
display: block;