Skip to content

Instantly share code, notes, and snippets.

View gist:6017
<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 = ?
View generator-bean.rb
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 Feb 16, 2009
Exemplo de script que faz backup do Redmine
View backup_redmine_with_mutt
#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
View business_bingo.rb
@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 Nov 30, 2021
Install Monaco font in Linux
View install_monaco_font.sh
#!/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
gedit-snippets-tool ... template for generating cheat sheets
View gedit-snippets-cheat-sheet-template.eruby
<!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;
View tdg.rb
#!/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 Oct 24, 2009
Access Oracle with jruby using JDBC. Export data to json format.
View oracle_export.rb
=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 Oct 27, 2009
Simple timer for Pomodoro Technique in shell script
View pomodoro.sh
#!/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
View ftp.sh
#! /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