Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
# login as root and run this script via bash & curl:
apt-get update
apt-get install -y build-essential bison openssl libreadline5 libreadline5-dev curl \
git-core zlib1g zlib1g-dev libopenssl-ruby libcurl4-openssl-dev libssl-dev \
libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libmysqlclient-dev \
mysql-client mysql-server
select * from (
select pk_codigo_pro, dt_entrada_nfi, preco_unt_nfi,
row_number() over (partition by pk_codigo_pro order by dt_entrada_nfi) as rownumber
from siai.mov_nf_entra_itens
) as a
where a.rownumber = 1
# CentOS 6.3 barebones walkthrough script for a new vps rails server instance
# assumes you already have a personal ssh key locally
# script implements the following security approaches:
# disables root login
# configures ssh setup for sys user
# opens up standard ports
#
# setup includes:
# rvm & ruby-1.9.3-p286
# mysql
@warlley
warlley / nginx
Last active December 17, 2015 11:38
#!/bin/sh
#
# nginx – this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /opt/nginx/conf/nginx.conf
# pidfile: /opt/nginx/logs/nginx.pid
@warlley
warlley / gist:5603211
Last active December 17, 2015 11:38
Centos Web Server Setup
# useradd deploy
# passwd deploy
# visudo
// Add line
deploy ALL=(ALL) ALL
$ sudo yum groupinstall "Development Tools"
$ sudo yum install openssl-devel readline-devel curl-devel
@warlley
warlley / .gitignore
Created January 3, 2013 10:50
.gitignore for delphi projects
*.dcu
*.ini
*.~*
*.bdsproj
*.cfg
*.dproj
*.dproj.local
*.bdsgroup
*.bdsgroup.local
*.bdsproj.local
@warlley
warlley / gist:3788319
Created September 26, 2012 14:17
show branch on shell
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
function proml {
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[1;31m\]"
local YELLOW="\[\033[0;33m\]"
local LIGHT_GREEN="\[\033[1;32m\]"
local WHITE="\[\033[1;37m\]"
xml.instruct! :xml, :version => "1.0"
xml.rss :version => "2.0" do
xml.channel do
xml.title "Titulo do blog"
xml.description "Este é um blog sobre..."
xml.link posts_url
for post in @posts
xml.item do
xml.title post.title
@warlley
warlley / gist:1234663
Created September 22, 2011 12:40
Rails Generators
config.generators do |g|
g.orm :mongoid
g.template_engine :erb
g.test_framework :rspec
end
@warlley
warlley / untitled.rb
Created May 16, 2011 14:24
Exemplo de busca e leitura de arquivos xml
#!/usr/bin/env ruby
require 'rubygems'
require 'nokogiri'
require 'find'
FIND_PATH = "/Users/warlley/Downloads/nfe"
Find.find(FIND_PATH) do |file_path|
if File.extname(file_path).downcase == '.xml'
nfe = Nokogiri::XML(File.open(file_path))