Skip to content

Instantly share code, notes, and snippets.

View alessandrostone's full-sized avatar

Alessandro Aresta alessandrostone

View GitHub Profile
#!/bin/sh
# #!/usr/bin/sh
#
# opensnoop - snoop file opens as they occur.
# Written using DTrace (Solaris 10 3/05).
#
# 12-Jan-2006, ver 1.60
#
# USAGE: opensnoop [-a|-A|-ceghsvxZ] [-f pathname] [-n name] [-p PID]
#
@alessandrostone
alessandrostone / gist:436ee7be26a3c147bebc
Last active February 19, 2016 02:26 — forked from fzero/gist:5182483
Detaching/reattaching Mac media keys to iTunes

You've been there...

Maybe you're listening to your favourite song on Rdio, or maybe checking your Soundcloud stream. You reach for the play/pause key on your keyboard and BAM, motherfucking iTunes comes up. Don't you hate that? I do.

Luckily, there's a way to fix it. Open your terminal and type:

launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist

Voilà, iTunes no longer responds to the media keys. The only downside is that now iTunes doesn't respond to the media keys at all. I couldn't care less, but if you're a crazy person who actually likes iTunes (poor you!), you can reattach the keys at any time with:

@alessandrostone
alessandrostone / finder_icons.sh
Created May 21, 2016 16:53 — forked from chockenberry/finder_icons.sh
A simple shell script to turn the Finders desktop icons on and off
#!/bin/sh
defaults read com.apple.finder CreateDesktop > /dev/null 2>&1
enabled=$?
if [ "$1" = "off" ]; then
if [ $enabled -eq 1 ]; then
defaults write com.apple.finder CreateDesktop false
osascript -e 'tell application "Finder" to quit'
open -a Finder
@alessandrostone
alessandrostone / hack.sh
Created May 28, 2016 12:19 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
#!/bin/sh
echo " ██████ ██████ ███████ ██ ██ ██ ██ ███████ ██████ ███████""
echo " ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██""
echo " ██████ ██████ █████ ██ █ ██ █████ █████ ██ ███ ███████""
echo " ██ ██ ██ ██ ██ ██ ███ ██ ██ ██ ██ ██ ██ ██""
echo " ██████ ██ ██ ███████ ███ ███ ██ ██ ███████ ██████ ███████""
echo ""
echo ""
echo " ███ ███ ███████ ██████ █████ ███████ ██ ██ ██""
@alessandrostone
alessandrostone / python
Last active November 12, 2016 17:12
easiest server ever
┌─────────────────────────────────────────────────────────────────────────────┐
│ __ │
│.-----.---.-.-----.--.--.-----.-----| |_ .-----.-----.----.--.--.-----.----.│
│| -__| _ |__ --| | | -__|__ --| _||__ --| -__| _| | | -__| _|│
│|_____|___._|_____|___ |_____|_____|____||_____|_____|__| \___/|_____|__| │
│ |_____| │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
# python -m SimpleHTTPServer 8000 python 2.*
@alessandrostone
alessandrostone / gist:cf8c31869db2a7ec9f8b4ac2ce8ce1a9
Created September 9, 2016 09:51
Fix Brew always get Already up-to-date.
If Homebrew was updated on Aug 10-11th 2016 and brew update always says Already up-to-date. you need to run:
cd "$(brew --repo)" && git fetch && git reset --hard origin/master && brew update
@alessandrostone
alessandrostone / Xcode Increment Build Run Phase Script
Created November 12, 2016 17:10
Xcode Increment Build Run Phase Script
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/${INFOPLIST_FILE}"
@alessandrostone
alessandrostone / colorLiteral.snippet
Created March 18, 2017 02:03
Xcode_Color_Literal_Snippet
#colorLiteral(red: 0.4593629837, green: 0.909394145, blue: 0.9056461453, alpha: 1)
@alessandrostone
alessandrostone / file_sharing.swift
Created May 2, 2018 16:12 — forked from artemnovichkov/file_sharing.swift
Explore Documents folder in Files.app. Inspired by Ole's tweet https://twitter.com/olebegemann/status/987346188591681536
#!/usr/bin/env xcrun --sdk macosx swift
import Foundation
enum Configuration: String {
case debug = "Debug"
case release = "Release"
}
// Get Info.plist path