Skip to content

Instantly share code, notes, and snippets.

View jdecode's full-sized avatar
🦾
Automate and Chill

Jagdeep Singh Kalsi jdecode

🦾
Automate and Chill
View GitHub Profile
@jdecode
jdecode / the-dockerfile-that-i-use.md
Last active June 21, 2020 04:23
Docker commands that I run almost every time I am qaing something new
#duh! Pick the base image (this is latest as of May 2020)
FROM php:7.4.5-apache

# Install composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

#duh!
RUN apt-get update
@jdecode
jdecode / youtube-thumbnail-url-from-video-id.md
Last active July 18, 2020 05:29
youtube-thumbnail-url-from-video-id

Stackoverflow answer link - https://stackoverflow.com/a/2068371/867451

Copied the content for quick reference


Each YouTube video has four generated images. They are predictably formatted as follows:

https://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg

https://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg

@jdecode
jdecode / controller-request-and-response-objects.md
Last active July 18, 2020 05:32
Laravel to CakePHP conversion

Instead of Illuminate\Http\Request, use Cake\Http\ServerRequest

Find Request $request and replace with ServerRequest $request

@jdecode
jdecode / gcp-manual-deploy-php-git-actions-steps.md
Last active July 18, 2020 05:37
Steps to run PHP code with manual code deploy (i.e. via git clone/pull) at Google Cloud Platform [GCP/GCE] : Basics++

High level actions

  1. Create a VM (Virtual Machine) - with minimal hardware specs : probably a version with 1 vCPU and less than (or equal to) 1 GB RAM
  2. Use Ubuntu as the OS (you can choose any other OS, but you have to make sure that the respective commands for any follow up actions are known and you are well versed with those).
  3. Enable/configure SSH to access the system
  4. Clone git repo (Github/Bitbucket/Gitlab etc) - and install any dependencies on the VM
  5. Configure any additional tools/services that the code is using (DB/PDO/JSON etc)
  6. Map the IP/generic-url to a domain name (if you don't have a domain, then make sure you sign-up for that - free or paid - choice is yours) - DNS management

Good to have (If not here, then where? If not now, then when?):

@jdecode
jdecode / setup-php-on-ubuntu-19-10.md
Last active July 18, 2020 05:41
Commands to install MySQL, PGSQL, PHP (multiple versions) in Ubuntu 19.10
@jdecode
jdecode / DynamoDB-dapier-admino.md
Last active September 4, 2020 11:22
DynamoDB data modelling for dapier/admino - first time DynamoDB/NoSQL, expect big and stupid mistakes

The more I watch Rick's sessions from 2017, 2018 and 2019, more confused I get - so I guess I'd write it down.

There are 3 core steps (some have more, I want to stick to 3) to create a decent model that works well:

  1. Understand the usecase + create ERD(list entities and relations)
  2. Identify the access patterns - R/W workloads, query dimensions and aggregations
  3. Data modeling - avoid relational patterns, use 1 table(if there aren't any "documents", 1 should be fine)
  4. R.R.R = Review > Repeat > Review (go on till it makes sense)
@jdecode
jdecode / geartable-db-design.md
Last active September 26, 2020 22:53
Geartable DB design

This gist is to jump to the DB designing (without explaining the "Why/How DynamoDB" part).

  1. ERD - Entity Relation Diagram
  2. Define the Access Patterns
  3. Design PK/SK
@jdecode
jdecode / geartable-ui-design.md
Created September 26, 2020 22:44
Geartable UI design

Idea is to have a UI (minimal)

That gets the job done (for now)

Using TailwindCSS (with Dark-mode support)

Configured in CakePHP (mono-repo setup)

Avoiding CORS (again, for now)

@jdecode
jdecode / noter-cakephp-mysql-docker.md
Last active September 30, 2020 08:21
Noter using Cakephp Mysql and Docker
@jdecode
jdecode / geartable-dev.md
Created September 27, 2020 18:05
Geartable development

Actual code has not started yet and I have been thinking about several ways to accompalish this:

  1. CakePHP, MySQL - No Vue/TailwindCSS/DynamoDB
  2. Slim(PHP), Postgres, Vue/TailwindCSS
  3. Slim(PHP), DynamoDB, Vue/Tailwindcss

Fastest one (for now) would be the first option - more experience, recently worked on this a lot

Taking specific notes from "Noter" development - more on this tomorrow