Techy Things

Upgrade Ruby 1.8 to 2.1 with ActiveRecord 4 0

Upgrade Ruby 1.8 to 2.1 with ActiveRecord 4

Old @friendRequests = Friendrequest.all(:conditions => { :friend_id => @user.id, :status => 0 }, :include => :requester ) @itemsInCart = Request.all(:conditions => [“offers.active = 1 AND requests.status = 1 AND requests.user_id = ?”, @user.id], :joins...

Google sign-in authentication in your webapp 0

Google sign-in authentication in your webapp

The Documentation https://developers.google.com/identity/sign-in/web/sign-in   The Catch Since it is javascript, anyone can inject code in your website via the debugger and send any email as received and simulate a positive signin from google authentication,...

Create a P7B certificates bundle 0

Create a P7B certificates bundle

P7B certificates file can contain one or more certificates and a revocation list. The difference with P12 (PKCS#12), P7B (PKCS#7) cannot contain private keys. To create a P7B file Assuming you have frank.pem and...

Create a DER encoded X509 certificate 0

Create a DER encoded X509 certificate

Two types of X509 certificates There are base64 encoded certificates which look like —–BEGIN CERTIFICATE—– MIIFcDCCA1gCAhAAMA0GCSqGSIb3DQEBCwUAMHExCzAJBgNVBAYTAkdCMRAwDgYD (…) lcH2kxKqa1CWUQGz3S9raNtesOI7jbO9d2HRVPPTPVTliHukS8tlBouq5tU6IFgH I61lVg== —–END CERTIFICATE—– Then there are DER encoded certificates which look like To convert base64 to...

String manipulations in Javascripts 0

String manipulations in Javascripts

String.indexOf() Return value: -1 if not found 0 or higher than 0 as the index of the position found Remove one part of a string Method 1: String.replace(//, “”); Method 2: var indexEnd =...

Create an intermediate CA 0

Create an intermediate CA

First step is required. If you don’t I wrote the instructions to setup a root CA. 1. Create folders (you are free to choose where) and add basic files: cd /etc/pki/tls/ mkdir intermediate-ca cd intermediate-ca...