Skip to content

Instantly share code, notes, and snippets.

View vivekkr12's full-sized avatar
🎯
Focusing

Vivek Kumar vivekkr12

🎯
Focusing
View GitHub Profile
@vivekkr12
vivekkr12 / h1b_2020.ipynb
Last active April 2, 2020 23:21
FY 2021 H1B lottery analysis
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Notes for Algorithms Revision

Dynamic Programming

  • Split the problem into sub problems such that their solutions can be used to construct the solution of the complete probelm
  • Mostly used in optimization problems like max sub array sum, stock buy sell etc.
  • Can't be used when there are more than one solution

Heaps

  • A binary heap is a binary tree i.e. each node must have two children. The tree is filled sequentially i.e. only the nodes at the end are allowed to have less than 2 children
  • Heaps satifies the heap invariant i.e. child nodes <= parent node (max heap) or child nodes >= parent nodes (min heap)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 8 columns, instead of 7 in line 8.
instance_type,runtime,estimated_time_aws,region,spot_price,on_demand_price,est_cost_spot_price,est_cost_on_demand_price
c5.18xlarge,12.297210693359375,8.538262414058279,eu-north-1,0.9828,3.276,0.0023309456390379103,0.007769818796793034
c5.18xlarge,12.297210693359375,8.538262414058279,ap-south-1,1.0432,3.06,0.002474198708429332,0.007257523051949537
c5.18xlarge,12.297210693359375,8.538262414058279,eu-west-3,1.0908,3.636,0.0025870935114596584,0.008623645038198862
c5.18xlarge,12.297210693359375,8.538262414058279,eu-west-2,1.1311,3.636,0.002682674615705922,0.008623645038198862
c5.18xlarge,12.297210693359375,8.538262414058279,eu-west-1,1.2367,3.456,0.002933130313184965,0.008196731917495948
c5.18xlarge,12.297210693359375,8.538262414058279,ap-northeast-2,1.0788,3.456,0.002558632636746131,0.008196731917495948
c5.18xlarge,12.297210693359375,8.538262414058279,ap-northeast-1,1.1976,3.852,0.002840395296410054,0.009135940783042357
c5.18xlarge,12.297210693359375,8.538262414058279,sa-east-1,1.4685,4.716,0.0034828995430679394
We can't make this file beautiful and searchable because it's too large.
instanceType,memory,vcpu,ecu,gpu,instanceFamily,operatingSystem,region,storage,price
r5.4xlarge,128,16,71,0,Memory optimized,Linux,eu-north-1,EBS only,1.0720000000
m5d.2xlarge,32,8,31,0,General purpose,Linux,eu-north-1,1 x 300 NVMe SSD,0.4800000000
r5.large,16,2,9,0,Memory optimized,Linux,eu-north-1,EBS only,0.1340000000
m5d.12xlarge,192,48,173,0,General purpose,Linux,eu-north-1,2 x 900 NVMe SSD,2.8800000000
m5.metal,384,96,345,0,General purpose,Linux,eu-north-1,EBS only,4.8960000000
c5d.large,4,2,9,0,Compute optimized,Linux,eu-north-1,1 x 50 NVMe SSD,0.1040000000
c5d.9xlarge,72,36,141,0,Compute optimized,Linux,eu-north-1,1 x 900 NVMe SSD,1.8720000000
i3.8xlarge,244,32,99,0,Storage optimized,Linux,eu-north-1,4 x 1900 NVMe SSD,2.6080000000
r5.12xlarge,384,48,173,0,Memory optimized,Linux,eu-north-1,EBS only,3.2160000000
@vivekkr12
vivekkr12 / BouncyCastleCertificateGenerator.java
Last active October 10, 2024 10:13
Generate root X509Certificate, Sign a Certificate from the root certificate by generating a CSR (Certificate Signing Request) and save the certificates to a keystore using BouncyCastle 1.5x
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.x500.X500Name;
import org.bouncycastle.asn1.x509.BasicConstraints;
import org.bouncycastle.asn1.x509.Extension;
import org.bouncycastle.asn1.x509.GeneralName;
import org.bouncycastle.asn1.x509.KeyUsage;
import org.bouncycastle.cert.X509CertificateHolder;
import org.bouncycastle.cert.X509v3CertificateBuilder;
import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter;