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
au BufNewFile,BufRead *.yml,*.yaml call s:DetectAnsibleVault() | |
fun! s:DetectAnsibleVault() | |
let n=1 | |
while n<10 && n < line("$") | |
if getline(n) =~ 'ANSIBLE_VAULT' | |
set filetype=ansible-vault | |
endif | |
let n = n + 1 | |
endwhile |
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
execute pathogen#infect() | |
set number | |
syntax on | |
set tabstop=4 | |
set shiftwidth=4 | |
set expandtab | |
set list | |
set listchars=tab:\ \ ,extends:»,precedes:«,trail:▒,nbsp:· | |
set statusline+=%F |
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
class Time | |
def self.random(t1, t2) | |
int = t2.to_i - t1.to_i | |
at(t1.to_i + rand(int+1)) | |
end | |
end | |
Time.random Time.now, Time.parse("2012/12/31") | |
=> Tue Nov 06 10:25:17 +0100 2012 |
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
class CvrInformation | |
require 'open-uri' | |
require 'nokogiri' | |
class CompanyNotFoundInCvr < Exception ; end | |
class << self | |
def get_company_from_vat_number(cvr) |
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
#!/usr/bin/perl | |
use Digest::HMAC_MD5 qw/ hmac_md5_hex /; | |
use DBI; | |
use URI::Escape; | |
use CGI; | |
print "Content-type: text/html\n"; | |
my $q = CGI->new; |
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
http://cvr.dk/Site/Forms/PublicService/DisplayCompany.aspx?cvrnr=30505166 | |
def extract_name(doc) | |
(doc/"div.titletext").inner_html.strip | |
end | |
def extract_address(doc) | |
(doc/"tr:contains('Adresse')/td.fieldvalue").inner_html =~ /^(.+)<br\W+\d{4}\W+(.+)$/ | |
$~[1].strip.gsub("<br />", ", ") | |
end |