Skip to content

Instantly share code, notes, and snippets.

@metalrufflez
metalrufflez / clly.py
Created July 25, 2012 03:11
Uploads a file to CloudApp and copies its link to the OSX Pasteboard
#!/usr/bin/python
'''
File: clly.py
Author: Caio "metalrufflez" Correa
Description: Upload a file to cloudapp and copies its link to the Pasteboard (OSX Only)
Dependencies: pycloudapp, poster, ordereddict
'''
import os
@metalrufflez
metalrufflez / setrotation.scpt
Created July 19, 2012 02:09
Rotate external display (OSX Lion only)
tell application "System Events"
if process "System Preferences" exists then
tell application "System Preferences"
quit
end tell
end if
set t to a reference to every desktop
set targetdisplay to display name of item 1 of t
@metalrufflez
metalrufflez / autophoto.sh
Created December 9, 2011 11:55
Takes a screenshot and a photo with isight
#!/bin/bash
PHOTODIR="~/Pictures/AutoPhotos"
/usr/sbin/screencapture -x -t jpg $PHOTODIR/$(date +%Y%m%d-%H%M)s.jpg
# The isightcapture does not comes with OSX, so you'll have to download it somewhere
# The developer took down it's site and I couldn't find it anywhere
/usr/local/bin/isightcapture $PHOTODIR/$(date +%Y%m%d-%H%M)p.jpg
@metalrufflez
metalrufflez / zmparseusers.sh
Last active September 28, 2015 10:18
Create a file to use with the zmcreateusers
#!/bin/bash
# zmparseusers
# Create a formatted list to be used with zmcreateusers
# AUTHOR: Caio Correa
# Provided a file with a list of names like
#
# John Doe
# Lucy Doe
@metalrufflez
metalrufflez / zmcreateuser.sh
Created December 2, 2011 16:48
Mass create zimbra accounts
#/bin/bash
# zmcreateusers
# Mass create zimbra accounts
#
# AUTHORS: Caio Corrêa, Thompson Alves
# LAST UPDATED: 2011/12/02
#
# Version 1.2: Added the report at the ending
# Version 1.1: Added security check of alias and username
@metalrufflez
metalrufflez / ora11bkphourly.sh
Created November 21, 2011 14:17
Dump and Oracle 11g (set it to run houly on cron)
#!/bin/bash
export ORACLE_HOME="/path/to/oracle/home"
export ORACLE_SID=SID
DB_BKPDIR="/path/to/backup/dir"
#EXPORT DA BASE DE DADOS
echo "Dumping Database"
#${ORACLE_HOME}/bin/exp \"/ as sysdba\" file=$DB_BKPDIR/bkp_hourly.dmp log=$DB_BKPDIR/bkp_hourly.log buffer=3000000 compress=y full=y
@metalrufflez
metalrufflez / ora11bkp.sh
Created November 21, 2011 14:16
Full backup an Oracle 11g database (remember to alter the target date to keep the backups)
#!/bin/bash
export ORACLE_HOME="/path/to/oracle/home"
export ORACLE_SID=SID
DB_BKPDIR="/path/to/backup/directory"
DMPFILE="bkp_$(date +%y%m%d).dmp"
TARFILE="bkp_$(date +%y%m%d).tar.bz2"
LOGFILE="bkp_$(date +%y%m%d).log"
@metalrufflez
metalrufflez / ora10bkphourly.sh
Created November 21, 2011 14:14
Dump an Oracle 10g (set it to run houly on cron)
#!/bin/bash
export ORACLE_HOME="/path/to/oracle/home"
export ORACLE_SID=SID
DB_BKPDIR="/path/to/backup/directory"
#EXPORT DA BASE DE DADOS
echo "Dumping Database"
${ORACLE_HOME}/bin/exp \"/ as sysdba\" file=$DB_BKPDIR/bkp_hourly.dmp log=$DB_BKPDIR/bkp_hourly.log buffer=3000000 compress=y full=y
@metalrufflez
metalrufflez / ora10bkp.sh
Created November 21, 2011 14:12
Script to fully backup Oracle 10g databases (remember to alter the target date)
#!/bin/bash
export ORACLE_HOME="/path/to/oracle/home"
export ORACLE_SID=SID
DB_BKPDIR="/path/to/backup/directory"
DMPNAME="bkp_$(date +%y%m%d).dmp"
TARNAME="bkp_$(date +%y%m%d).tar.bz2"
LOGNAME="bkp_$(date +%y%m%d).log"
@metalrufflez
metalrufflez / mlogrotate.sh
Created November 21, 2011 14:08
manual logrotate (remember to adapt the FILE_DATE to your case)
#!/bin/bash
FILE_DIR="/path/to/dir/"
DATE_TARGET=$(date +"%Y%m%d" --date='2 days ago')
for FILE_NAME in $(ls $FILE_DIR/*.log)
do
FILE_DATE=$(echo $FILE_NAME | cut -d"-" -f2 | cut -d"." -f1)
if [ "$FILE_DATE" -le "$DATE_TARGET" ]; then
rm -f $FILE_NAME