plutil -p example.webloc | sed -En 's/.*"(.*)"$/\1/p'
webloc2url.sh - Converts .webloc (Mac) to .url (Windows) files.
Unless otherwise noted (either in this file or in a file's copyright section) the contents of this gist are Copyright ©️2020 by Christopher Allen, and are shared under spdx:Creative Commons Attribution Share Alike 4.0 International (CC-BY-SA-4.) open-source license.
If you more tips and advice like these, you can become a monthly patron on my GitHub Sponsor Page for as little as $5 a month; and your contributions will be multipled, as GitHub is matching the first $5,000! This gist is all about Homebrew, so if you like it you can support it by donating to them or becoming one of their Github Sponsors.
| /* Ultra lightweight Github REST Client */ | |
| // original inspiration via https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb | |
| const token = 'github-token-here' | |
| const githubClient = generateAPI('https://api.github.com', { | |
| headers: { | |
| 'User-Agent': 'xyz', | |
| 'Authorization': `bearer ${token}` | |
| } | |
| }) |
| const fetch = (...args) => console.log(...args) // mock | |
| function httpRequest(url, method, data) { | |
| const init = { method } | |
| switch (method) { | |
| case 'GET': | |
| if (data) url = `${url}?${new URLSearchParams(data)}` | |
| break | |
| case 'POST': | |
| case 'PUT': | |
| case 'PATCH': |
| git config --global diff.tool bbdiff | |
| git config --global difftool.bbdiff.cmd 'bbdiff --wait --resume "$LOCAL" "$REMOTE"' | |
| git config --global difftool.prompt false | |
| git config --global merge.tool bbdiff | |
| git config --global mergetool.bbdiff.cmd 'bbdiff --wait --resume "$LOCAL" "$REMOTE"' | |
| Double check ~/.gitconfig |
| // when T is any|unknown, Y is returned, otherwise N | |
| type IsAnyUnknown<T, Y, N> = unknown extends T ? Y : N; | |
| // when T is never, Y is returned, otherwise N | |
| type IsNever<T, Y = true, N = false> = [T] extends [never] ? Y : N; | |
| // when T is a tuple, Y is returned, otherwise N | |
| // valid tuples = [string], [string, boolean], | |
| // invalid tuples = [], string[], (string | number)[] |
| /* | |
| Copy this into the console of any web page that is interactive and doesn't | |
| do hard reloads. You will hear your DOM changes as different pitches of | |
| audio. | |
| I have found this interesting for debugging, but also fun to hear web pages | |
| render like UIs do in movies. | |
| */ | |
| const audioCtx = new (window.AudioContext || window.webkitAudioContext)() |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <!-- Launch Daemon do not always have access to all the path variables | |
| As a results, scripts will sometimes fail if the you are using path variables inside them | |
| To enable the script to have access to all path variables, open up a terminal and type in --> | |
| <!-- echo $PATH --> | |
| <!-- You can opt to filter out some of the path variables which are not required by script--> | |
| <key>EnvironmentVariables</key> |
| #Gets screen capture of device every 270 seconds and outputs screencap to timestamped png file in local directory | |
| while true; do adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > ScreenCap.`date +%Y`.`date +%m`.`date +%d`-`date +%H`.`date +%M`.`date +%S`.png; sleep 270; done | |
| #Gets logs from device and outputs them to a timestamped file in local directory | |
| while true; do adb logcat -v time > logging`date +%Y`.`date +%m`.`date +%d`-`date +%H`.`date +%M`.`date +%S`.txt; done | |
| #Gets PID of <packagename> | |
| adb shell ps | grep <packagename> | |
| #Outputs battery level to console |
| # GIT heart FZF | |
| # ------------- | |
| is_in_git_repo() { | |
| git rev-parse HEAD > /dev/null 2>&1 | |
| } | |
| fzf-down() { | |
| fzf --height 50% "$@" --border | |
| } |