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 | |
unless ARGV[0] | |
puts 'Usage: newpost "the post title"' | |
exit(-1) | |
end | |
date_prefix = Time.now.strftime("%Y-%m-%d") | |
postname = ARGV[0].strip.downcase.gsub(/ /, '-') | |
post = "/Users/al3x/src/al3x.github.com/_posts/#{date_prefix}-#{postname}.textile" |
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 | |
export_to='/path/to/export/without/slash' | |
login='login' | |
server='server.com' | |
root='/path/to/app/without/slash' | |
rm -rf $export_to | |
git checkout-index -a --prefix=$export_to/ | |
rsync -avz -e ssh $export_to/ $login@$server:$root --exclude-from 'exclude.rsync' |
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
#!/opt/local/bin/ruby | |
def random_string(length=15) | |
chars = 'abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789' | |
password = '' | |
length.times { password << chars[rand(chars.size)] } | |
password | |
end | |
if ARGV.first | |
puts random_string(ARGV.first.to_i) |
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
def random_string(length=10) | |
chars = 'abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789' | |
string = '' | |
length.times { string << chars[rand(chars.size)] } | |
string | |
end |
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 | |
# Backup all dbs in separate files | |
# adapted from | |
# http://www.usercore.com/backup-all-mysql-databases-as-seperate-sql-files/ | |
# use mysqldump5 for MacPorts, mysqldump otherwise | |
user='user' | |
password='password' | |
to='/path/to/backup/folder' # without final / |
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
# ~/rails-modele.rb | |
# Initialisation du dépôt | |
git :init | |
# Copie du fichier de configuration de la base de données vers une version d'exemple | |
run "cp config/database.yml config/database.yml.default" | |
# Ajout d'un fichier .gitignore dans chaque répertoire vide | |
# Git ne versionne que le contenu des fichiers, un répertoire ou fichier vide est ignoré |
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 | |
git init | |
echo "<?php" > config/config.php | |
find . -type d -empty | xargs -I % touch %/.gitignore | |
echo 'tmp/**/*' >> .gitignore | |
echo 'tmp/**/**/*' >> .gitignore | |
ignored_files=( .htaccess config/core.php config/config.php config/database.php webroot/.htaccess webroot/index.php webroot/test.php ) | |
for ignored_file in ${ignored_files[@]} | |
do | |
cp $ignored_file $ignored_file.default |
NewerOlder