Skip to content

Instantly share code, notes, and snippets.

View emilpetkov's full-sized avatar

Emil Petkov emilpetkov

View GitHub Profile
class TransactionIdSequence < ActiveRecord::Base
belongs_to :contract
def next_transaction_id
TransactionIdSequence.transaction do
TransactionIdSequence.connection.execute("UPDATE `#{self.class.table_name}` SET `transaction_id_sequence` = `transaction_id_sequence` + 1 WHERE `id` = #{id}")
TransactionIdSequence.connection.select_value("SELECT `transaction_id_sequence` FROM `#{self.class.table_name}` WHERE `id` = #{id}").to_i
end
end
end
@emilpetkov
emilpetkov / whois info
Created February 2, 2017 22:30
ezeecard.com WHOIS
→ whois ezeecard.com
Whois Server Version 2.0
Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.
Domain Name: EZEECARD.COM
Registrar: DYNAMIC NETWORK SERVICES, INC
@emilpetkov
emilpetkov / hack.sh
Created July 29, 2012 22:37 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@emilpetkov
emilpetkov / gist:3201958
Last active February 16, 2023 09:10
Set up e-banking using smart card reader and electronic signature under OS X Mountain Lion (10.8)

This guide is for you if:

  • You have a smart card reader and (universal) electronic signature bought from InfoNotary (can be a different company, hardware, etc – just change the necessary steps), you are using Mac OS X, and want to do some e-banking because you value your time and prefer to cut your wrists instead of physically visiting a bank in BG to do any kind of work.
  • You haven’t set up e-banking under Mac OS before OR you did set it up but then you decided to upgrade to Mountain Lion (OS X 10.8) because it is simply better.

Follow these steps:

  1. Download the smart card reader driver. Note I personally own ACR38T USB dongle, so I used:
    wget http://repository.infonotary.com/install/mac/OpenSC-0.12.2-10.7.dmg

    Run pcsctest from the terminal to check your exact card reader model, find, and install the relevant driver for it – check this link%
@emilpetkov
emilpetkov / decrypt_data.sh
Created January 31, 2012 18:20
Decrypt and scp CSV files to remote server
for file in *.pgp
do
if [[ $file =~ (\.*).pgp ]]; then
file_no_pgp="${file%.*}"
gpg --passphrase your_passphrase_here --output $file_no_pgp --decrypt $file
scp $file_no_pgp your_username@your_server:/var/www/ipg_data
echo "Decrypted ans scped file for processing: $file_no_pgp"
fi
done