Skip to content

Instantly share code, notes, and snippets.

#battery
sudo pmset -b standbydelaylow 300
sudo pmset -b standby 1
sudo pmset -b halfdim 1
sudo pmset -b sms 0
sudo pmset -b disksleep 10
sudo pmset -b standbydelayhigh 600
sudo pmset -b sleep 10
sudo pmset -b autopoweroffdelay 40000
sudo pmset -b hibernatemode 25
@fortinmike
fortinmike / convert-epub-to-mobi-with-calibre.sh
Created March 5, 2019 14:11
Convert EPUB files and packages to MOBI using the Calibre CLI (the app must be installed)
#!/bin/bash
DIRNAME=$(dirname -- "$1")
BASENAME=$(basename -- "$1")
if [ ! -d "$1" ]; then
# The EPUB is already a file, convert straight away
/Applications/calibre.app/Contents/MacOS/ebook-convert "$1" "$DIRNAME/$BASENAME.mobi"
else
# The EPUB is a directory, convert it to a file before conversion
@phodal
phodal / install.sh
Created February 20, 2019 02:39
macOS Reinstall Shell Backup
#!/bin/bash
# erase-install
#
#
# WARNING. This is a self-destruct script. Do not try it out on your own device!
#
#
# Specifically, this script does the following:
# 1. Checks whether a valid existing macOS installer (>= 10.13.4) is already present in the `/Applications` folder
@mustafaakin
mustafaakin / find_blur_photos.py
Created February 18, 2019 20:14
Finding blurred photos by album
import os
import sqlite3
import cv2
import numpy as np
def score(filename):
image = cv2.imread(filename)
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

My 2Do tasks

This is just contents of my never ending lists of tasks I tagged in 2Do with read, watch and check tags.

All lists are sorted by priority. I hope to bring all these lists closer to 0 when I get time. But until then, perhaps you will find something interesting in them.

Here are the lists I share so far.

@n8henrie
n8henrie / repair.sh
Last active July 7, 2021 00:16
Fix time machine backup
#!/usr/bin/env bash
# http://tonylawrence.com/post/unix/fixing-corrupted-time-machine-backups/
set -euf -o pipefail
set -x
if [[ $(whoami) != 'root' ]]; then
echo "Please run as root" > /dev/stderr
exit 1
fi
@cybniv
cybniv / calibre_meta
Created October 22, 2018 22:54
calibre persist metadata in pdf
#!/usr/bin/env ruby
files = Dir.glob(ENV['HOME'] + "/Calibre Library/**/*.pdf")
# meta = Dir.glob(ENV['HOME'] + "/Calibre Library/**/metadata.opf")
dirs = []
for file in files
dirs << [ File.dirname(file), File.basename(file) ]
end
@ccstone
ccstone / Raw_AppleScript_Event_Codes_2006.tsv
Last active April 14, 2025 10:56
Raw AppleScript Event Codes (2006)
Code Terminology Kind Usage Line
$scr scripting additions folder Property of class: domain System Events : Disk-Folder-File Suite 1
%doc music folder Property of class: user domain object System Events : Disk-Folder-File Suite 2
µdoc music folder Enumeration Standard Additions : File Commands 3
ƒhlp help Enumeration Standard Additions : File Commands 4
ƒhlp help folder Enumeration Standard Additions : File Commands 5
ƒlib shared libraries Enumeration Standard Additions : File Commands 6
ƒlib shared libraries folder Enumeration Standard Additions : File Commands 7
ƒmod modem scripts Enumeration Standard Additions : File Commands 8
ƒmod modem scripts folder Enumeration Standard Additions : File Commands 9
@grahampugh
grahampugh / Disable_macOS_Upgrade_Notifications.sh
Last active October 19, 2021 14:38
Script to prevent the macOS Upgrade Notification popup, or delete it if it's already installed
#!/bin/bash
# Disable macOS Upgrade notifications
# Step 1: prevent the update which brings the notification down
softwareupdate --ignore macOSInstallerNotification_GM
echo
# Step 2: delete the file if it's already on the computer
@jonathantneal
jonathantneal / recovery.sh
Last active November 10, 2023 01:01
Create or update macOS Big Sur (or Catalina, or Mojave) Recovery Partition Without Reinstalling
#!/bin/sh
# Set the macOS installer path as a variable
MACOS_INSTALLER="/Applications/$(ls /Applications | grep "Install macOS")"
MOUNT_POINT="$MACOS_INSTALLER/Contents/SharedSupport"
echo "macOS installer is \"$MACOS_INSTALLER\""
# Set the target disk as a variable
TARGET=$(diskutil info "$(bless --info --getBoot)" | awk -F':' '/Volume Name/ { print $2 }' | sed -e 's/^[[:space:]]*//')
echo "Target disk is \"$TARGET\""