Skip to content

Instantly share code, notes, and snippets.

View jitensachdeva's full-sized avatar

Jitendra sachdeva jitensachdeva

View GitHub Profile
@jitensachdeva
jitensachdeva / install-docker.md
Created February 10, 2021 10:23 — forked from npearce/install-docker.md
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start
@jitensachdeva
jitensachdeva / openssl_tls_1.2.patch
Created April 24, 2017 12:33 — forked from kriansa/openssl_tls_1.2.patch
Source patch to add support to TLS 1.1 and 1.2 to Ruby 1.9.3
--- a/ext/openssl/ossl_ssl.c
+++ b/ext/openssl/ossl_ssl.c
@@ -107,6 +107,18 @@
OSSL_SSL_METHOD_ENTRY(TLSv1),
OSSL_SSL_METHOD_ENTRY(TLSv1_server),
OSSL_SSL_METHOD_ENTRY(TLSv1_client),
+#if defined(HAVE_TLSV1_2_METHOD) && defined(HAVE_TLSV1_2_SERVER_METHOD) && \
+ defined(HAVE_TLSV1_2_CLIENT_METHOD)
+ OSSL_SSL_METHOD_ENTRY(TLSv1_2),
+ OSSL_SSL_METHOD_ENTRY(TLSv1_2_server),
@jitensachdeva
jitensachdeva / README.md
Created December 1, 2015 03:37 — forked from hofmannsven/README.md
My simply MySQL Command Line Cheatsheet
@jitensachdeva
jitensachdeva / index.md
Last active August 29, 2015 14:13 — forked from rstacruz/index.md

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@jitensachdeva
jitensachdeva / decorator.js
Created July 23, 2014 09:59
Implement a Logger function that accepts a function you specify wraps it with a function that logs the start time and the finish time to the console and returns the decorated function. Demonstrate it by decorating an add function that accepts two numbers and returns the sum, and now also logs the start time and end time.
function getDateTime() {
var now = new Date();
var year = now.getFullYear();
var month = now.getMonth()+1;
var day = now.getDate();
var hour = now.getHours();
var minute = now.getMinutes();
var second = now.getSeconds();
if(month.toString().length == 1) {
var month = '0'+month;
@jitensachdeva
jitensachdeva / iterator.js
Created July 23, 2014 07:49
Implementation of each on iterator in javascript
var Iterator = function (values) {
this.values = values;
}
Iterator.prototype = {
each : function (block) {
for (var i = 0; i < this.values.length; i++) {
block(this.values[i]);
@jitensachdeva
jitensachdeva / square.js
Created July 23, 2014 07:14
sample to show inheritance in js
var Polygon = function(){
this.sides = arguments;
}
Polygon.prototype.perimeter = function(){
var sum = 0;
for(var i=0 ; i < this.sides.length; i++) {
sum = sum + this.sides[i];
}
class Line { private:
bool changed; double length; Point start; Point end;
public:
void setStart(Point p) { start = p; changed = true; }
void setEnd(Point p) Point getStart(void)
Point getEnd(void)
double getLength() { if (changed) {
{ end = p; changed = true; } { return start; }
{ return end; }
length = start.distanceTo(end);