Skip to content

Instantly share code, notes, and snippets.

View ekas's full-sized avatar
😇
Loving it.

Ekas Preet Singh ekas

😇
Loving it.
  • Lufthansa Technik
  • Hamburg, Germany
  • 07:29 (UTC +02:00)
  • X @ekaspreet93
View GitHub Profile
@ekas
ekas / AES.c
Created October 26, 2016 04:36 — forked from bricef/AES.c
A simple example of using AES encryption in Java and C.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
* MCrypt API available online:
* http://linux.die.net/man/3/mcrypt
*/
#include <mcrypt.h>
@ekas
ekas / Google ICS: Mobile Web, Course 2 Summary.md
Created March 2, 2018 16:04 — forked from gpalsingh/Google ICS: Mobile Web, Course 2 Summary.md
My notes on course on ES6. Not comprehensive.

Lesson 6: Syntax

  • let: Variables can be reassigned, but can’t be redeclared in the same scope.
  • const: Variables must be assigned an initial value, but can’t be redeclared in the same scope, and can’t be reassigned.
  • Hoisting: Before any JavaScript code is executed, all variables are hoisted, which means they're raised to the top of the function scope.
  • Temporal dead zone: If a variable is declared using let or const inside a block of code, then the variable is stuck in what is known as the temporal dead zone until the variable’s declaration is processed.
  • Suggested to ditch var in place of using let and const.
  • Template literals: Denoted with backticks ( `` ), template literals can contain placeholders which are represented using ${expression}.
  • Examples:
@ekas
ekas / node_nginx_ssl.md
Last active February 14, 2021 15:58 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@ekas
ekas / ImageLoad.js
Created August 26, 2020 17:32 — forked from nirajrajgor/ImageLoad.js
Progressive load image component in react with hooks
import React, { useState, useEffect } from 'react';
const ImageLoad = React.memo(({ src, placeholder, alt = "" }) => {
const [loading, setLoading] = useState(true);
const [currentSrc, updateSrc] = useState(placeholder);
useEffect(() => {
// start loading original image
const imageToLoad = new Image();
imageToLoad.src = src;
@ekas
ekas / clean_code.md
Created April 29, 2021 11:49 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

Guide

CMD

Postgres

  • docker pull bitnami/postgresql
  • docker run --name postgresql-server -e POSTGRESQL_PASSWORD=pass bitnami/postgresql:latest

Docker Specific terminal