Skip to content

Instantly share code, notes, and snippets.

def set_rnd_pass
digitpct = 0.4
letterset = ('A'..'Z').to_a - ['I', 'O']
#begin
passwd = ''
8.times do
if rand < digitpct
passwd << rand(10).to_s
else
@dlapiduz
dlapiduz / System setup
Created August 20, 2009 23:29
System Setup
- Install Xcode http://developer.apple.com/mac/scripts/downloader.php?path=/Developer_Tools/xcode_3.1.3_developer_tools/xcode313_2736_developerdvd.dmg
- Rename mac ruby:
sudo bash
mv /usr/bin/ruby /usr/bin/ruby.orig
mv /usr/bin/gem /usr/bin/gem.orig
mv /usr/bin/rails /usr/bin/rails.orig
logout
- Install Macports: http://www.macports.org/install.php
# Configuration supporting multiple users with any type of
# IPsec/L2TP client. This includes the updated Windows 2000/XP
# (MS KB Q818043), Vista and Mac OS X 10.3+ but excludes the
# non-updated Windows 2000/XP.
#
# Authenticates through a Pre-Shared Key. Supports clients that
# are not behind NAT. Does not support clients that are behind NAT.
conn L2TP-PSK
#
cat ~/.ssh/id_rsa.pub | ssh account@remoteserver.com "mkdir ~/.ssh 2>/dev/null; chmod 700 ~/.ssh; cat - >> .ssh/authorized_keys; chmod 644 ~/.ssh/authorized_keys"
@dlapiduz
dlapiduz / eydeploy.rb
Created April 20, 2012 23:13
config/eydeploy.rb
def conditionally_enable_maintenance_page
return true
end
@dlapiduz
dlapiduz / gist:2656687
Created May 11, 2012 00:01
Copy SSH key in one line
cat ~/.ssh/id_dsa.pub | ssh user@hostname "cat - >> ~/.ssh/authorized_keys"
@dlapiduz
dlapiduz / test_mrss.rb
Created July 17, 2012 13:50
MRSS Tester
require "rubygems"
require 'open-uri'
require "nokogiri"
url = "http://cdn.playwire.com/343/mrsses/397.xml"
doc = Nokogiri::HTML(open(url))
doc.xpath('//item/content').each do |d|
url_to_get = d.attributes['url'].value
@dlapiduz
dlapiduz / gist:4745769
Created February 9, 2013 15:48
HMDA create table
CREATE TABLE hmda
(year integer,
respondent char(10),
agency integer,
loan_type integer,
property_type integer,
loan_purpose integer,
occupancy integer,
loan_amount integer,
preapproval integer,
@dlapiduz
dlapiduz / gist:5595758
Created May 16, 2013 22:59
.gitconfig
[alias]
c = commit -m
ci = commit
st = status
a = add
aa= !git add -u && git add . && git status
cob = checkout -b
up = !git fetch upstream && git rebase upstream/master
ir = !git rebase -i origin/master
done = !git fetch && git rebase origin/master && git checkout master && git merge @{-1} && rake && git push
@dlapiduz
dlapiduz / python.pp
Created November 27, 2013 18:39
Puppet script to install Python 2.7 in Centos 6.4
class python {
file { "/tmp/rpm":
owner => root,
group => root,
mode => 644,
ensure => directory,
source => "puppet:///files/rpm/",
recurse => true,
}