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
function timestamp() { | |
[ -z "$1" ] && date "+%s" && return | |
date -d "$1" "+%s" | |
} | |
function ts2dt() { | |
date -d "@$1" | |
} |
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/sh | |
############################################################################ | |
# Convert all mp3 files of a directory to a constant bitrate | |
############################################################################ | |
BITRATE=96 | |
if [ "x$1" != "x" ]; then | |
DIR=$( (cd -P "`dirname "$1"/.`" && pwd) ) | |
else | |
BASEDIR=$( (cd -P "`dirname "$0"`" && pwd) ) |
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 php | |
<?php | |
setlocale(LC_ALL, 'en_US.UTF8'); | |
$string = "Iúri Diniz come açúcar"; | |
echo iconv('UTF-8', 'ASCII//TRANSLIT', $string) . "\n"; | |
?> |
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 | |
SIZE=8 | |
change_font() { | |
local schema="$1" | |
local key="$2" | |
local size="$3" | |
local new_font=$( gsettings get "$schema" "$key" |perl -pe "s/\\d+/$size/" ) |
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/sh | |
current=$( uname -r ) | |
find /boot -name 'vmlinuz-*' | while read i; do | |
version_full=$( echo $i | perl -pe 's/^.*?vmlinuz-//' ) | |
version_mini=$( echo $version_full | perl -pe 's/-\D+//g' ) | |
if [ "$version_full" = "$current" ]; then |
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/sudo sh | |
# Configure this | |
SSH_HOST="myhost.com.br" | |
SSH_PORT="2222" | |
########### | |
SSH_LOGIN="root" # ONLY root CAN SETUP TUNNELS :-( | |
####################################################### | |
# USUALLY, you don't need to configure this |
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/sh | |
READLINK=`which readlink` | |
SCRIPT_LOCATION=$0 | |
if [ -x "$READLINK" ]; then | |
while [ -L "$SCRIPT_LOCATION" ]; do | |
SCRIPT_LOCATION=`"$READLINK" -e "$SCRIPT_LOCATION"` | |
done | |
fi | |
SCRIPT_HOME=`dirname "$SCRIPT_LOCATION"` |
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/sh | |
DBPATH="$HOME/.mongodb" | |
PORT="27017" | |
IP="127.0.0.1" | |
BASENAME=$(basename "$0") | |
PID="/tmp/$BASENAME.pid" | |
LOG="/tmp/$BASENAME.log" | |
MONGOD_CONFIG="/tmp/$BASENAME.config" |
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/sh | |
####### | |
# use: | |
# ln -s $THIS $DESIRED_BINARY_AT_VIRTUAL_ENV_BIN | |
. ~/Sources/PYTHON/bin/activate | |
EXEC=$(basename $0) | |
EXECFULL="$VIRTUAL_ENV/bin/$EXEC" |
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
*.pyc | |
.project | |
.pydevproject |