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
@glowinthedark
glowinthedark / applescript-detect-language-objc-bridge.applescript
Last active June 10, 2025 06:05
MacOS Applescript to detect language of text string and say it using TTS Voice for detected language
use framework "Foundation"
use framework "NaturalLanguage"
use framework "AVFoundation"
-- https://www.macscripter.net/t/detect-language-from-sentence-for-speech-synthesizer/74560
(**
* import Foundation
* import NaturalLanguage
* import AVFoundation
@stephancasas
stephancasas / toggle-ventura-sidecar.jxa.js
Last active June 5, 2025 08:44
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
*
#define STEP 12
void setup() {
// 200 step per revolution motor driver on this pin.
pinMode(STEP, OUTPUT);
}
void topSpeed_1Turn() {
for (int i = 0; i < 200; i++) {
// Issue 1 step.
@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 July 4, 2025 11:52
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 June 4, 2025 00:14
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 July 10, 2025 21:02
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.