Some install scripts. Target to work with Ubuntu 12 or greater.
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 | |
# Install Monaco font in Linux | |
# Version from nullvideo https://gist.github.com/rogerleite/99819#gistcomment-2799386 | |
sudo mkdir -p /usr/share/fonts/truetype/ttf-monaco && \ | |
sudo wget https://gist.github.com/rogerleite/b50866eb7f7b5950da01ae8927c5bd61/raw/862b6c9437f534d5899e4e68d60f9bf22f356312/mfont.ttf -O - > \ | |
/usr/share/fonts/truetype/ttf-monaco/Monaco_Linux.ttf && \ | |
sudo fc-cache |
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
user www-data; | |
worker_processes 4; | |
error_log logs/error.log; | |
#error_log logs/error.log notice; | |
#error_log logs/error.log info; | |
pid logs/nginx.pid; | |
events { |
Example: "one plus two times four"
- numbers are [zero-ten]
- numbers can be negative, for example: "negative five"
- "plus" and "times" are the only supported operations natural order of operations apply, multiply before add.
- "negative" is optional string before the number and is not an operation "one minus two" is expressed as "one plus negative two"
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
# example 1: adopting default values and trying to not break things | |
def adapter(action) | |
action = action.to_sym unless action.is_a?(Symbol) | |
batch = { | |
active_products: "ProductsActive", | |
inactive_products: "ProductsInactive", | |
download_products: "ProductsDownload" | |
} | |
batch.fetch(action, "UnknownAction") | |
end |
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
require "csv" | |
require "date" | |
puts CSV::HeaderConverters.keys.inspect # => [:downcase, :symbol] | |
# Add new header converter | |
CSV::HeaderConverters[:remap] = lambda do |raw_value| | |
raw_value = raw_value.to_sym | |
case raw_value | |
when :country |
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
#ARQUIVO: bkp_redmine.sh | |
#!/bin/sh | |
BACKUP_FOLDER=/home/minha_empresa/backup/redmine | |
DATE_BACKUP=`date +%Y%m%d` | |
DB_FILE_BKP="$BACKUP_FOLDER"/"$DATE_BACKUP"_redmine_db.gz | |
FILES_FOLDER_BKP="$BACKUP_FOLDER"/files | |
FILES_FILE_BKP="$BACKUP_FOLDER"/"$DATE_BACKUP"_redmine_files.gz |
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
=begin | |
Requisitos Minimos para rodar este script: | |
#jruby 1.1 ou superior (nao testei com superior :D) | |
apt-get install jruby | |
#baixar o oracle jdbc (para o 10g, ou procure a versão que deseje) de: | |
http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc_10201.html | |
#copiar o ojdbc14.jar para (usar sudo): |
NewerOlder