This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" \ | |
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<dict> | |
<key>Label</key> | |
<string>com.ejoubaud.symlinkntfsdisk</string> | |
<key>LowPriorityIO</key> | |
<true/> | |
<key>Program</key> | |
<string>/Users/ejoubaud/Library/Scripts/symlink_ntfs_disk.bash</string> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# List all crontabs on a box (from http://stackoverflow.com/questions/134906/how-do-i-list-all-cron-jobs-for-all-users) | |
for user in $(cut -f1 -d: /etc/passwd); do sudo crontab -u $user -l; done | |
# See what's eating up disk space | |
sudo du -h / | grep '[0-9]G' | |
# Multiple ssh, install i2cssh | |
# cmd+shift+i to broadcast' | |
# Terminal.app alternative is csshx | |
i2cssh -mdj1,dj2,dj3,dj4,dj5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select case | |
when user_agent like '%iPad%' then '4.iPad' | |
when user_agent like '%iPhone%' then '4.iPhone' | |
when user_agent like '%Android%' then '4.Android' | |
when user_agent like '%Mac OS X%' then '4.OS X' | |
when user_agent like '%X11%' then '4.Linux' | |
when user_agent like '%Windows NT 6.3%' then '3.Windows 8.1' | |
when user_agent like '%Windows NT 6.2%' then '3.Windows 8' | |
when user_agent like '%Windows NT 6.1%' then '3.Windows 7' | |
when user_agent like '%Windows NT 6.0%' then '2.Windows Vista' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
awk 'FNR%10!=0 {printf "%d, ",$1} FNR%10==0 {print $1}' file_with_one_val_per_line.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# If you're not using rbenv in this script's dir, you may wanna run | |
# these as `sudo gem install ruby-trello`, etc. | |
['ruby-trello', 'dotenv'].each do |gem_name| | |
begin | |
gem gem_name | |
rescue LoadError | |
puts "Running `gem install #{gem_name}`..." | |
puts "If this takes too long, you may want to run it manually, as `sudo` if needed." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TARGET_DB=wordpress_default | |
# This is meant for a dev env (VVV actually), you may want to use something more secure to store credentials, and possibly a user with target-db-specific privileges. | |
ROOT=root | |
ROOT_PW=root | |
mysql -u${ROOT} -p${ROOT_PW} -e'SHOW DATABASES;' | |
echo "Warning! This will copy the content of ${TARGET_DB}, which may take a lot of disk space (possibly more than you have." | |
read -p "What name for your snapshot? " snapshot |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Identify the revision of kernel running: | |
uname -r | |
# Identify installed kernel packages: | |
dpkg --get-selections | awk '((/^linux-/) && (/[0-9]./)) {print $1}' | |
# Reboot box if not running the latest installed kernel. | |
sudo reboot | |
# Remove kernel packages (being careful not to uninstall the currently running kernel). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Based on http://stackoverflow.com/a/10520017/1307721 and http://stackoverflow.com/a/16022728/1307721 | |
Podium = {}; | |
Podium.keydown = function(k) { | |
var oEvent = document.createEvent('KeyboardEvent'); | |
// Chromium Hack | |
Object.defineProperty(oEvent, 'keyCode', { | |
get : function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
multicom () { | |
echo Usage: multicom command arg1 arg2 arg3 arg4... | |
echo e.g. multicom "ssh %s" web1 web2 web3 | |
echo | |
read -r -d '' code <<-APPLESCRIPT | |
activate application "iTerm" | |
tell application "System Events" to keystroke "n" using command down | |
APPLESCRIPT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mark="# DOCKER_MACHINE:" && sudo sed -i '' "/$mark/d" /etc/hosts && docker-machine ls -q | while read m; do echo "$(docker-machine ip $m) $m.docker ${mark} $m" | sudo tee -a /etc/hosts; done |