Skip to content

Instantly share code, notes, and snippets.

#! /bin/bash
# =====================================================
# * macOS Maintenance Script *
# * Written by Kristan M. Kenney (iCeFuSiOn) *
# * Modified by Mike Wilkie (github.com/MikeWilkie) *
# * Last modified on May 1, 2018 06:05:18 PM EST *
# * Revision 1.0.1c *
# * For use on macOS 10.13 High Sierra Only! *
# * I AM NOT RESPONSIBLE IF YOU DO SOMETHING WRONG! *
@slowkow
slowkow / take-screenshot.scpt
Last active May 26, 2025 20:13
Applescript to take a screenshot with the application title in the filename.
-- take-screenshot.scpt
-- Kamil Slowikowski
-- 2025-05-26
-- Get the title of the frontmost application window.
-- https://stackoverflow.com/questions/5292204
global frontApp, frontAppName, windowTitle
set windowTitle to ""
tell application "System Events"
set frontApp to first application process whose frontmost is true
@gunderwonder
gunderwonder / link-devonthink-bear-things.applescript
Created May 6, 2018 17:19
Creates a named DEVONthink group, a Bear note and Things project, linked together
#!/usr/bin/env bash
set -e
addEntries() {
# check if universal access / custom menu key exists
if defaults read com.apple.universalaccess com.apple.custommenu.apps > /dev/null 2>&1; then
defaults delete com.apple.universalaccess com.apple.custommenu.apps
fi
@hawkfalcon
hawkfalcon / nssharingservice.swift
Created May 2, 2018 23:09
Custom NSSharingService & NSSharingServicePickerDelegate
extension ViewController: NSSharingServicePickerDelegate {
func sharingServicePicker(_ sharingServicePicker: NSSharingServicePicker, sharingServicesForItems items: [Any], proposedSharingServices proposedServices: [NSSharingService]) -> [NSSharingService] {
guard let image = NSImage(named: NSImage.Name("copy")) else {
return proposedServices
}
var share = proposedServices
let customService = NSSharingService(title: "Copy Text", image: image, alternateImage: image, handler: {
if let text = items.first as? String {
self.setClipboard(text: text)
@hawkfalcon
hawkfalcon / sharesheet.swift
Last active March 31, 2019 07:05
Share Sheet NSSharingServicePicker
@IBAction func shareSheet(_ sender: NSButton) {
let text = "Text to share..."
let sharingPicker = NSSharingServicePicker(items: [text])
sharingPicker.delegate = self
sharingPicker.show(relativeTo: NSZeroRect, of: sender, preferredEdge: .minY)
}
@jimratliff
jimratliff / Mac_keyboard_ASCII_and_virtual_keys.tsv
Last active October 10, 2025 20:34
ASCII and Mac Virtual Key codes for editing com.apple.symbolichotkeys plist. (See sources/information in first comment.) #dotfiles #character_codes #symbolichotkeys
Keyboard Label Character ASCII code (Parameter #1) Mac Virtual Key Code (Parameter #2) Layout dependence?
0 0 48 029 ANSI-US
1 1 49 018 ANSI-US
2 2 50 019 ANSI-US
3 3 51 020 ANSI-US
4 4 52 021 ANSI-US
5 5 53 023 ANSI-US
6 6 54 022 ANSI-US
7 7 55 026 ANSI-US
@skyzh
skyzh / Bear.md
Created April 18, 2018 15:04
Prepare Bear App exported notes for printing

Texts are darkened and serif-ied for better printing visual effects.

Before

image

After

image

@unbug
unbug / disable_autospell.md
Last active July 12, 2024 21:06 — forked from urbanautomaton/disable_autospell.md
disable autospell completely
sudo mv /System/Library/Services/AppleSpell.service{,.disabled}

Nvm. For anyone else having this problem you need to reboot your mac and press ⌘+R when booting up. Then go into Utilities > Terminal and type the following commands:

csrutil disable
reboot 
@benizar
benizar / multiple-git-clone.md
Last active October 8, 2025 17:41
Ubuntu post-installation script for cloning multiple git repositories.

multiple-git-clone.sh

Every time I install Ubuntu on a different computer, I need to clone again the same git repositories. This is why I use this bash script.

Usage

It clones the list of repositories to a convenient working directory in the home folder. I use the /home/git folder.

Arguments are lists of git repositories. One repo per line, one file per list. See the example: