Skip to content

Instantly share code, notes, and snippets.

View mig8447's full-sized avatar
🎯
Focusing

Miguel Sánchez Villafán mig8447

🎯
Focusing
  • Zapopan, Jalisco, México
View GitHub Profile
@stephancasas
stephancasas / toggle-ventura-sidecar.jxa.js
Last active May 9, 2024 17:05
Toggle sidecar or screen mirroring from Control Center in macOS Ventura
#!/usr/bin/env osascript -l JavaScript
/**
* -----------------------------------------------------------------------------
* Activate Sidecar/Screen Mirroring from Control Center
* -----------------------------------------------------------------------------
*
* Created on February 17, 2023 by Stephan Casas
* Updated on May 18, 2023 by Stephan Casas
*
@spencerfeng
spencerfeng / abortableSearchItems_after.ts
Created July 25, 2022 12:16
For tutorial: Create an abortable API using AbortController and AbortSignal
const abortableSearchItems = (
searchString: string,
signal: AbortSignal
): Promise<Item[]> => {
if (signal.aborted) {
return Promise.reject(new Error("searchAborted"));
}
return new Promise((resolve, reject) => {
const abortSearchHandler = () => {
@lukaskubanek
lukaskubanek / fn-shortcuts.md
Last active February 21, 2024 16:26
macOS Monterey Keyboard Shortcuts Leveraging the Fn Key
Shortcut Description Overridable?[^1]
Fn-A Navigate Dock No
Fn-Shift-A Launchpad No
Fn-C Control Center No
Fn-E Emoji & Symbols Yes
Fn-F Enter/Exit Full Screen Yes
Fn-H Desktop No
Fn-M Navigate Main Menu Yes
Fn-N Notifications No
@drewkerr
drewkerr / get-focus-mode.js
Last active April 23, 2024 12:34
Read the current Focus mode on macOS Monterey (12.0+) using JavaScript for Automation (JXA)
const app = Application.currentApplication()
app.includeStandardAdditions = true
function getJSON(path) {
const fullPath = path.replace(/^~/, app.pathTo('home folder'))
const contents = app.read(fullPath)
return JSON.parse(contents)
}
function run() {
@tangoabcdelta
tangoabcdelta / generate zip archive of a git repository ignoring the files listed in `.gitignore` instructions.md
Created February 22, 2021 07:57
Generate zip archive of a git repository ignoring the files listed in `.gitignore`:

I have a git repo which compiles into a dist folder and generates a bunch binaries (executables). The binaries and dist folders are .gitignore-ed and hence, are not included in the repo. But I want to distribute a source + binaries snapshot zipfile. I want them to contain:

a) all the sources b) all the binaries c) the dist folder (so that they can tweak it) d) not the .git/ directory, not the hidden files like .cache or node_modules/ etc.

@ChristopherA
ChristopherA / brew-bundle-brewfile-tips.md
Last active May 19, 2024 09:23
Brew Bundle Brewfile Tips

Brew Bundle Brewfile Tips

Copyright & License

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.

Sponsor

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.

  • SC1000 $ is not used specially and should therefore be escaped.
  • SC1001 This \o will be a regular 'o' in this context.
  • SC1003 Want to escape a single quote? echo 'This is how it'\''s done'.
  • SC1004 This backslash+linefeed is literal. Break outside single quotes if you just want to break the line.
  • SC1007 Remove space after = if trying to assign a value (or for empty string, use var='' ... ).
  • SC1008 This shebang was unrecognized. ShellCheck only supports sh/bash/dash/ksh. Add a 'shell' directive to specify.
  • SC1009 The mentioned parser error was in ...
  • SC1010 Use semicolo
@rayana
rayana / aoe2hd.md
Last active March 15, 2022 06:02 — forked from yocontra/aoe2hd.md
Age of Empires II HD - For Mac OSX

AOE2HD - For Mac OSX

Estimated time: 10 minutes

Notice

This configuration worked for macOS High Sierra, Version 10.13.6.

According to the original Gist, PlayOnMac does not work on macOS Catalina, and issues have been reported with the latest version of Steam. Updating is in progress, read more here.

@qzm
qzm / docker-compose.yml
Last active May 20, 2024 11:22
Atlassian docker-compose (JIRA,Confluence,Bitbucket) with nginx and letsencrypt
version: '2'
services:
watchtower:
image: containrrr/watchtower
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /root/.docker/config.json:/config.json
command: nginx-proxy nginx-proxy-le
@julianxhokaxhiu
julianxhokaxhiu / create-iso.sh
Last active March 25, 2024 16:15
Simple bash script to create a Bootable ISO from macOS Catalina Install Image from Mac App Store
#!/usr/bin/env bash
#===========================================================================
# Works only with the official image available in the Mac App Store.
# Make sure you download the official installer before running this script.
#===========================================================================
hdiutil create -o /tmp/Catalina.cdr -size 9000m -layout SPUD -fs HFS+J
hdiutil attach /tmp/Catalina.cdr.dmg -noverify -mountpoint /Volumes/install_build
sudo /Applications/Install\ macOS\ Catalina.app/Contents/Resources/createinstallmedia --volume /Volumes/install_build --nointeraction
hdiutil detach "/Volumes/Install macOS Catalina"