Skip to content

Instantly share code, notes, and snippets.

View dvrensk's full-sized avatar

David Vrensk dvrensk

  • Barcelona, Spain
View GitHub Profile
def xls(name: "Workbook-#{Time.current.strftime("%Y-%m-%d--%H-%M-%S")}.xlsx")
package = Axlsx::Package.new
sheet = package.workbook.add_worksheet(name: "Sheet 1")
yield sheet
package.serialize(name)
system("open", name) if RUBY_PLATFORM.match("darwin")
name
end
@dvrensk
dvrensk / get_all.rb
Created February 16, 2018 11:10
Script to download all screencasts from ElixirSips using the RSS feed. Should work for other podcast feeds too.
#! /usr/bin/env ruby
require "nokogiri"
require "date"
require "fileutils"
require "pry"
class GetAll
def self.run
check_upass
secret for severus:
-----BEGIN PGP MESSAGE-----
hQIMA4cB+JcyVcmoAQ//eymp0JAOZHVzye75XFxqxx90qduc7b8MN6IjOHIgZMP3
eAtCGYcPCULE8cTn5fYNV7rgnuI8v153ezQZqIu/Y4hYvIc4hxabl4AUzLVEPbKz
...
SARdTPEcGS92
=HWmD
-----END PGP MESSAGE-----
secret for luna:
@dvrensk
dvrensk / sharing_secrets.sh
Last active September 1, 2017 14:07
Simple command line to encrypt secrets for different users
for u in severus luna albus minerva
do
echo -n "secret for $u:"
read -s secret
echo
echo $secret | gpg -ea -r $u@sequra.es --trust-model always -
done
@dvrensk
dvrensk / redsys_result_codes.rb
Created February 4, 2015 17:02
These are the result codes from Spanish payment gateway Redsys (formerly Sermepa) that I've managed to collect. The list is no doubt incomplete, and I'll be happy to update it if you have any more codes.
RESULT_CODES = (<<-EOT).split(/\r?\n/).reject {|s| s.match(/^( *#.*)?$/)}.map { |s| s.sub(/^ +/,'').split(/ +/,2) }.to_h
# Copied from http://dwalins.com/2014/codigo-de-respuesta-de-sermepa-redsys/
0101 Tarjeta Caducada
0102 Tarjeta en excepción transitoria o bajo sospecha de fraude
0104 Operación no permitida para esa tarjeta o terminal
0106 Intentos de PIN excedidos
0116 Disponible Insuficiente
0118 Tarjeta no Registrada
0125 Tarjeta no efectiva
0129 Código de seguridad (CVV2/CVC2) incorrecto

Keybase proof

I hereby claim:

  • I am dvrensk on github.
  • I am dvrensk (https://keybase.io/dvrensk) on keybase.
  • I have a public key whose fingerprint is AD02 C088 57D8 F5C8 414D 00D0 1CC1 745F 23B2 377C

To claim this, I am signing this object:

@dvrensk
dvrensk / gotest-me.el
Created January 29, 2013 22:58
gotest-me is part of the upcoming kata-minor-mode, designed to do TDD katas in Emacs with feedback as overlays in the code, mostly making compilation buffers unnecessary.
(defun gotest-me ()
"Run `go test' on the current file. Requires output in stretchrcom/testify format.
Install with `go get github.com/stretchrcom/testify'"
(interactive)
(when (buffer-modified-p) (save-buffer))
(remove-overlays)
(let*
((out (make-temp-file "gotest-out"))
(errbuf (get-buffer-create "*go test*"))
(ignore (with-current-buffer errbuf
@dvrensk
dvrensk / .bashrc
Created February 27, 2009 08:30 — forked from djmitche/git-prompt.sh
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir [master] $ # clean working directory
# username@Machine ~/dev/dir [master*] $ # dirty working directory
# djmitche: *edit* an existing PS1 to add the git information
# djmitche: only invoke 'git' and 'sed' once (each) for each prompt
# djmitche: display [NO BRANCH] when not on a branch (e.g., during rebase -i)
# dvrensk: added a semicolon after the sed q command to make OS X happy
function __git_info {
#!/bin/bash
VERSION="1.1"
REEV="http://rubyforge.org/frs/download.php/48623/ruby-enterprise-1.8.6-20081215.tar.gz"
REEF="ruby-enterprise-1.8.6-20081215.tar.gz"
REEFF=${REEF%".tar.gz"}
PASSENGER="2.0.6"
echo "#####################################"
echo "Welcome, let's get this party rollin'"
echo "#####################################"