Skip to content

Instantly share code, notes, and snippets.

<defs>
<query>
<class>org.example.entities.Client</class>
<name>SEARCH_CLIENT</name>
<descr>Alguma descrição desatualizada.</descr>
<filter>
<![CDATA[
select id, column1, column2, column3
from tabela_exemplo
where id = ?
require 'rexml/document'
include REXML
doc = Document.new( File.new('ex-query-hibernate.xml') )
root = doc.root
root.each_element('//query') { |query|
name = query.elements['name'].text #vem um SEARCH_CLIENT
arr_temp = name.split('_').each { |n|
@rogerleite
rogerleite / backup_redmine_with_mutt
Created February 16, 2009 17:34
Exemplo de script que faz backup do Redmine
#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
@business_words = ['Sinergia','Mentalidade','Agregar','Mercado','E-mail','Follow up','Clientes','Benefício','Parceiros','Estratégia','Sistema','Rendimento','Pró-ativo','Business','Custos','Otimização','Foco','Efetivamente','A nível de','Recursos','Resultados','Paradigma','Projeto','Implementação','Integrar']
#puts @business_words
#puts '=========================================='
def generate_card number_words, number_columns
random_words = random_business_words number_words
card = []
number_lines = (number_words / number_columns)
@rogerleite
rogerleite / install_monaco_font.sh
Last active April 27, 2024 05:27
Install Monaco font in Linux
#!/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
@rogerleite
rogerleite / gedit-snippets-cheat-sheet-template.eruby
Created May 4, 2009 11:52
gedit-snippets-tool ... template for generating cheat sheets
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Cheat Sheet Gedit Snippets</title>
<style>
span {
border-bottom: 1px solid;
text-align: center;
font-size: 3em;
#!/usr/bin/ruby -w
#
# tdg - Thread Dump Grapher (any better name?)
#
# Given a Java Thread Dump file as argument, it prints out
# a Grapviz (.dot) to generate a graph that shows which threads
# are waiting on others for a lock.
# (tested with a Sun JDK 1.4 thread dump)
#
# from: http://neuroning.com/2005/11/24/graphical-thread-dumps
@rogerleite
rogerleite / oracle_export.rb
Created October 24, 2009 13:41
Access Oracle with jruby using JDBC. Export data to json format.
=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):
@rogerleite
rogerleite / pomodoro.sh
Created October 27, 2009 18:58
Simple timer for Pomodoro Technique in shell script
#!/bin/bash
# http://www.pomodorotechnique.com/
#Icones:
#/usr/share/icons/hicolor/48x48/apps/typing-monitor.png
#/usr/share/icons/hicolor/48x48/apps/evolution-tasks.png
#Requisitos:
#sudo apt-get install beep
#! /bin/sh
#reference: http://www.mysysad.com/2008/01/ftp-using-shell-script.html
REMOTE='esoft'
USER='anyuser'
PASSWORD='myftp125'
FTPLOG='/tmp/ftplog'
date >> $FTPLOG