Skip to content

Instantly share code, notes, and snippets.

View shredthaGNAR's full-sized avatar

Me shredthaGNAR

View GitHub Profile
@shredthaGNAR
shredthaGNAR / airdropSorter.scpt
Created September 23, 2022 21:55 — forked from menushka/airdropSorter.scpt
A Folder Action script written in AppleScript used to separate AirDropped files into a different folder other than the default Downloads folder
property AIRDROP_FOLDER : "Path:to:AirDrop:Folder:in:Alias:format"
property QUARANTINE_KEY : "59"
property GET_QUARANTINE_COMMAND_START : "ls -l -@ '"
property GET_QUARANTINE_COMMAND_END : "' | tr '\\n' ' ' | sed 's/.*com\\.apple\\.quarantine\\s*\\(\\d*\\)/ \\1/' | awk '{$1=$1};1'"
on adding folder items to this_folder after receiving added_items
repeat with i from 1 to length of added_items
set current_item to item i of added_items
set quarantine_type to getQuarantineType(POSIX path of current_item)
@shredthaGNAR
shredthaGNAR / sublime-text-macos-context-menu.md
Created September 23, 2022 21:47 — forked from idleberg/sublime-text-macos-context-menu.md
“Open in Sublime Text” in macOS context-menu

This list has been updated for Big Sur (and later). Since I don't use these versions, this guide might still need further improvements. For older macOS versions, please see this older revision.

Open in Sublime Text

  • Open Automator
  • Quick Action
  • Set “Service receives selected” to files or folders in any application
  • Add a Run Shell Script action
  • Set the script action to /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -n "$@"
  • Set “Pass input” to as arguments
@shredthaGNAR
shredthaGNAR / enable-touch-id-for-sudo.md
Created September 21, 2022 10:10 — forked from windyinsc/enable-touch-id-for-sudo.md
macOS - Enable Touch ID for sudo

Enable Touch ID for sudo

Thanks to this awesome Six Colors post: Quick Tip: Enable Touch ID for sudo

The short of it:

  1. In your terminal go to cd /etc/pam.d/.
  2. Now open the sudo file with your favorite command-line/GUI text editor.
    • Note that if you open it via the command-line, you’ll need to use sudo itself to do so, since the file is (understandably) protected.
  3. With the sudo file open, add the following command below below the first line. auth sufficient pam_tid.so
@shredthaGNAR
shredthaGNAR / aliases.zsh
Created September 4, 2022 00:13 — forked from CyberPunkCodes/aliases.zsh
Oh-My-Zsh - Best and Most Helpful - My Custom ZSH Aliases - Tips Hack Help Info Doc Tutorial
# Source Reload
alias reload.zsh="source ~/.zshrc"
alias reload.profile="source ~/.bash_profile"
alias reload.term="source ~/.bash_profile && source ~/.zshrc"
# cd
alias ..="cd .."
# ls
alias ll="ls -AlhG"
@shredthaGNAR
shredthaGNAR / sim.cc
Created August 27, 2022 08:47 — forked from bwasti/sim.cc
/*
sim.cc
Compile:
g++ sim.cc -std=c++11 -lpheval -O3 -o sim -IPokerHandEvaluator/cpp/include -LPokerHandEvaluator/cpp/build
./sim
Run: (all arguments are optional, defaults to 9 player full runouts)
./sim [number of other players 1-8] [cards on the board 3-5] [top % highlighted] [number of runouts per hand]
e.g.
@shredthaGNAR
shredthaGNAR / userscript.js
Created August 12, 2022 05:43 — forked from gildas-lormeau/userscript.js
Save page in reader mode with SingleFile
// ==UserScript==
// @name Save page in reader mode
// @namespace https://github.com/gildas-lormeau/SingleFile/
// @version 1.0
// @description Save page in reader mode with SingleFile
// @author Gildas Lormeau
// @match *://*/*
// @grant none
// ==/UserScript==
@shredthaGNAR
shredthaGNAR / YT-DLP Downloader Automator Script.txt
Created August 10, 2022 22:33
Use Automator to create a shell script that willl automatically download any selected URL using YT-DLP and FFmpeg and initiatd by any shorrtcut you decide to use
Unlike Windows, Mac users don't have download manager like IDM that can download basically everything and has a good browser extension support for one click away from downloading. Mac users can download videos with apps like Jdownloader or Neatdownloadmanager but they don't have good experience or they don't support enough websites.
So what about yt-dlp? well it nice and simple but if i need to open Terminal and manually run the command for downloading videos every single time then i better stick with the other options.
The solution i have came up with is to automate yt-dlp using Apple's Automator app. This allows to just select a url and with one keyboard shortcut it will download the video to default folder and when finished it will popup a dialog asking if i want to open the folder or close the dialog.
\Just so you know i don't have any coding skills so the code might not look good for someone who knows how to code with bash and applescript.*
@shredthaGNAR
shredthaGNAR / btt-screenshot.sh
Created August 9, 2022 10:04 — forked from jerieljan/btt-screenshot.sh
Screenshot OCR with BetterTouchTool on MacOS
#!/usr/bin/env bash
# Usage:
# - Install `tesseract` with `brew install tesseract`
# - In BetterTouchTool, create a trigger of your choice.
# (I recommend a Keyboard Shortcut with Cmd+Shift 6)
# - Add an Execute Shell Script / Task action
# - Paste this script.
# NOTE: You'll need to authorize BTT to the Screen Recording permission in Security and Privacy at System Preferences
[[snippets]]
description = "start dev file syncer. uses fswatch to know when to run rsync. does not sync .git file. Sort like a write-through cache network file system with only eventual consistency guarantees."
command = "fswatch -0 --exclude \"\\.git\" --exclude \"\\.xml\" --exclude \"___\" -o /Users/chris/Documents/workspace/lingt_chris_dev_rsync_checkout/myproject | xargs -0 -n 1 -I {} rsync --progress --exclude '*.pyc' --exclude '*.git' --recursive ~/workspace/lingt_chris_dev_rsync_checkout/myproject [email protected]:/home/user/webapps/dev_chris/myproject"
output = ""
[[snippets]]
description = "plex find unscanned tv!"
command = "cat <(find /Users/chris/Downloads/media/dbx_mount/tv -type f | sed 's/.*\\///' | grep 'mp4\\|mkv\\|avi') <(unbuffer /Applications/Plex\\ Media\\ Server.app/Contents/MacOS/Plex\\ Media\\ Scanner -c 4 --tree | grep 'mp4\\|mkv\\|avi' | sed 's/.*\\///' | sed 's/\\w*\\[.*\\]$//' | awk '{$1=$1};1') | sort | uniq -u"
output = ""
@shredthaGNAR
shredthaGNAR / youtube-dl.py
Created July 31, 2022 19:46 — forked from nneonneo/youtube-dl.py
YouTube-DL for Pythonista - download YouTube videos on your iPhone/iPad!
#!python3
'''
Directions:
- install yt-dlp via Pip (e.g. using (StaSh)[https://github.com/ywangd/stash] - `pip install yt-dlp`)
- add this script as a Share extension through Settings -> Share Extension Shortcuts
- while watching a video in the YouTube site or app, just share the video to Pythonista and select this script
- the video will download, and when it's done you can share the video file itself with any app (e.g. VLC)
Advanced usage: