This file contains 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
import random | |
import urllib | |
import urllib2 | |
import tempfile | |
import subprocess | |
from appscript import app, mactypes | |
import lxml.html as lh | |
url = "http://simpledesktops.com/browse/" | |
random_page = str(random.randint(1,20)) |
This file contains 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
now() { | |
$file="$HOME/.now" | |
if [[ -z $@ ]]; then | |
today="$(date "+%Y-%m-%d")" | |
grep --color=never $today $file | cut -d' ' -f2- | |
else | |
stamp="$(date "+%Y-%m-%d %H:%M:%S")" | |
echo $stamp - "$@" >> $file | |
fi | |
} |
This file contains 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 bash | |
pushd /var/www/html/ | |
# Set default permissions | |
find . -type d -exec chmod 755 '{}' ';' | |
find . -type f -exec chmod 644 '{}' ';' | |
# Set directories permissions | |
ee_dirs=( |
This file contains 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 | |
usage() | |
{ | |
cat << EOF | |
usage: $0 ENV OPTIONS | |
This script will deploy to the host host. | |
ENVIRONMENTS: |
This file contains 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
# Dynamically generated file dropped off by Chef! | |
fs.file-max=131072 | |
kernel.shmall=32768 | |
kernel.shmmax=536870912 | |
net.core.netdev_max_backlog=4096 | |
net.core.optmem_max=25165824 | |
net.core.rmem_default=25165824 | |
net.core.rmem_max=25165824 | |
net.core.somaxconn=4096 |
This file contains 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
RESTORE='\[\033[0m\]' | |
RED='\[\033[00;31m\]' | |
GREEN='\[\033[00;32m\]' | |
YELLOW='\[\033[00;33m\]' | |
PURPLE='\[\033[00;35m\]' | |
GRAY='\[\033[00;37m\]' | |
# Normal user is purple, root is red. | |
if [ "$(id -u)" == '0' ]; then | |
USER_COLOR=$RED |
This file contains 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
# save last status | |
PROMPT_COMMAND='export last_status=$?' | |
PS1="\n\u@\H:\w\$(git_prompt)\n\$(last_status)\$ " | |
# only show status when non zero | |
function last_status { | |
if [ $last_status -gt 0 ]; then | |
echo $last_status | |
fi |
This file contains 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 bash | |
if ! pgrep -q Rdio | |
then | |
echo "Error: Rdio is not running"; exit 1 | |
fi | |
function check { | |
which "$1" || echo "Missing dep: $1"; exit 1 | |
} |
This file contains 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
# Note: uses some random ClientID for authentication, does not handle errors | |
# Usage: $ imgur ~/Desktop/oleg.png | |
function imgur { | |
[ $# -lt 1 ] && echo "imgur: requires an image file path" && exit 1 | |
curl -sH "Authorization: Client-ID 3e7a4deb7ac67da" -F "image=@$1" "https://api.imgur.com/3/upload" | grep -oE "http:.*\.[a-z]{3,4}" | tr -d '\' | |
} |
OlderNewer