Skip to content

Instantly share code, notes, and snippets.

@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() {
@varenc
varenc / dropbox_pause_resume_example.applescript
Created May 1, 2021 03:01
Pause and Resume Dropbox's syncing from the command line with AppleScript
tell application "System Events"
-- Pause syncing
click menu bar item 1 of menu bar 2 of application process "Dropbox"
click menu item "Pause Syncing" of menu 1 of menu bar item 1 of menu bar 2 of application process "Dropbox"
delay 2
-- Now re-enable syncing
click menu bar item 1 of menu bar 2 of application process "Dropbox"
click menu item "Resume Syncing" of menu 1 of menu bar item 1 of menu bar 2 of application process "Dropbox"
end tell
@Wowfunhappy
Wowfunhappy / web-sharing.sh
Last active December 4, 2020 21:18
Enable Apache
#!/bin/bash
if (( $(echo "${OSTYPE:6} > 13" | bc -l) ))
then
mkdir ~/Sites ; sudo bash -c "printf '<Directory \"/Users/`whoami`/Sites/\">\n\tAddLanguage en .en\n\tAllowOverride All\n\tOptions Indexes MultiViews FollowSymLinks\n\tRequire all granted\n</Directory>' > /etc/apache2/users/`whoami`.conf ; echo 'AddDefaultCharset utf-8' >> /etc/apache2/httpd.conf ; sed -i '' '/LoadModule userdir_module libexec\/apache2\/mod_userdir.so/s/^#*//g' /etc/apache2/httpd.conf ; sed -i '' '/LoadModule php[0-9]*_module libexec\/apache2\/libphp[0-9]*.so/s/^#*//g' /etc/apache2/httpd.conf ; sed -i '' '/Include \/private\/etc\/apache2\/extra\/httpd-userdir.conf/s/^#*//g' /etc/apache2/httpd.conf ; sed -i '' '/Include \/private\/etc\/apache2\/users\/\*.conf/s/^#*//g' /etc/apache2/extra/httpd-userdir.conf ; apachectl start"
elif (( $(echo "${OSTYPE:6} > 10" | bc -l) ))
then
mkdir ~/Sites ; sudo bash -c "printf '<Directory \"/Users/`whoami`/Sites/\">\n\tAddLanguage en .en\n\tAllowOverride All\n\tOptions Indexes MultiViews Follow
@selimslab
selimslab / get_gists.py
Last active December 23, 2023 15:52 — forked from leoloobeek/get_gists.py
Download all gists of a user
import sys
from subprocess import call
import json
import os
import requests
def download_gists(gists: list):
for gist in gists:
call(["git", "clone", gist["git_pull_url"]])
@merlinmann
merlinmann / twitter-bios.md
Last active April 24, 2024 06:29
bios - Merlin likes to change his Twitter bio for some reason. #runx

Good Twitter Bios runx

Bios

The bar is in the globe.

This is a factory, not a circus.

I weigh less than a slice of bread.

@jessamynwest
jessamynwest / peacefuleasygmail.css
Last active April 23, 2024 18:35
Slightly calmer gmail
@-moz-document url-prefix("https://mail.google.com/mail/") {
/*
*****
This style is based off of Nicer New Gmail but it's really more of a slash and burn approach.
NO COLORS except tiny bit of red and yellow and some blue I can't get rid of.
I know just enough CSS to be dangerous and not enough to really make things work correctly. Some things it
chokes on:
- tabs! I don't use them so who cares what they look like
- hangout/chat tab - I disabled this as soon as they added it, maybe it's blue, I don't know
@jkubecki
jkubecki / ExportKindle.js
Last active February 25, 2024 00:45
Amazon Kindle Export
// The following data should be run in the console while viewing the page https://read.amazon.com/
// It will export a CSV file called "download" which can (and should) be renamed with a .csv extension
var db = openDatabase('K4W', '3', 'thedatabase', 1024 * 1024);
getAmazonCsv = function() {
// Set header for CSV export line - change this if you change the fields used
var csvData = "ASIN,Title,Authors,PurchaseDate\n";
db.transaction(function(tx) {
@kroo
kroo / README.md
Last active June 26, 2017 18:11
A quick n' dirty hack to fix a dying GrowlVoice

How to Use

Open up Terminal.app in your /Applications/Utilities directory, then type in these commands, one after each other:

  1. Create a temporary directory for cycript:

    mkdir cycript && cd cycript
    
  2. Pull the latest cycript from cycript.org:

@thewellington
thewellington / crashplanFixup.sh
Last active October 27, 2018 06:11
Prevent CrashPlan from de-duplicating data on a Mac. Improves transfer speed! #mac #blog #crashplan
#!/bin/bash
#
# crashplanFixup.sh for Macintosh OS X 10.9 (and probably earlier versions)
#
# This script will prevent CrashPlan from de-duplicating data on files greater than 1k.
# Based on information from http://networkrockstar.ca/2013/09/speeding-up-crashplan-backups/
#
# NOTE: Must be run with sudo! IE: $ sudo sh ./crashplanFixup
#
# v1.1 2014-03-13 by bill@wellingtonnet.net
@ttscoff
ttscoff / voicesms.rb
Last active December 27, 2015 00:39
Google voice SMS from command line. I've lost track of versions...
#!/usr/bin/env ruby -Ku
require 'net/http'
require 'net/https'
require 'open-uri'
require 'cgi'
require 'optparse'
ACCOUNT = 'USERNAME' # Set to Google Voice account email for default account
PASSWORD = 'PASSWORD' # Set to Google Voice account password for default account