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 / full-stack-development-in-laravel.md
Last active May 25, 2023 17:51
Full stack development in Laravel

Question

Full stack development in Laravel : What to pick and how? [opinionated, highly]

Answer

It depends on the skill set of the developer.

Developer traits #1

  1. Highly competent and experienced in PHP, and have been writing APIs in Laravel for a significant amount of time
  2. Has some experience in writing HTML, CSS and JavaScript, and can use the HTML helpers provided by design team (or from Tailwind components, or some other framework) to create Blade templates
@jdecode
jdecode / xdebug.md
Created January 2, 2023 21:54
Setup Xdebug in PhpStorm when PHP/Xdebug is in Docker container

In Docker

  1. Install xdebug in docker
  2. discover_client_host to be set to false/0
  3. client_host to be set to docker.host.internal, using extra_hosts as host.docker.internal:host-gateway

In PhpStorm

  1. Start listening
  2. PHP > Debug : Clear Break at first line in PHP scripts, Debug port = 9000,9003 [check Can accept external connections]
  3. PHP > Servers : + : Host/Port of docker, map public/index.php of host and server
@jdecode
jdecode / Postgres-CLI-commands.md
Last active March 19, 2024 07:36
psql-cli.md

Informational (options: S = show system objects, + = additional detail)

  \d[S+]                 list tables, views, and sequences
  \d[S+]  NAME           describe table, view, sequence, or index
  \da[S]  [PATTERN]      list aggregates
  \dA[+]  [PATTERN]      list access methods
  \dAc[+] [AMPTRN [TYPEPTRN]]  list operator classes
  \dAf[+] [AMPTRN [TYPEPTRN]]  list operator families
  \dAo[+] [AMPTRN [OPFPTRN]]   list operators of operator families
@jdecode
jdecode / gcloud-commands.md
Last active October 14, 2022 19:05
Deploy a delivery pipeline in GCP for Cloud Run [in preview, as of Oct 22]

Sample commands to:

  1. Create a new delivery pipeline:
gcloud deploy apply --file=clouddeploy.yaml --region=asia-southeast1 --project=jdecode
  1. Create a new release:
gcloud deploy releases create test-release-001 \
--project=jdecode \
--region=asia-southeast1 \
@jdecode
jdecode / choice-of-os.md
Created October 4, 2022 17:17
Choice of OS : Linux / Windows / Mac

Note : Choice of OS is not a "preference", it's a result of the work you do

  1. If you are into web-dev, using Java, Python, PHP, React, Vue, TailwindCSS, Alpinejs, Docker etc - then use any popular Linux distro, say, "Ubuntu" [or Fedora / Debian / CentOS etc]
  2. If you create mobile apps that need to be deployed to App Store (Apple), using Swift, Kotlin, React Native etc - then use "Mac OS"
  3. If you create applications (desktop/web) that require DLL-files/MS-libraries using, say, C#,.Net core etc - then use "Windows"

Opinion:
If you are into non-window-binding and non-mac-os-binding web-dev, and incline toward using Windows or Mac OS, then change your career or the OS

@jdecode
jdecode / env-vars.md
Last active September 21, 2022 16:39
Environment Variables in GCP / Cloud Run / Laravel App

Env vars

  • APP_NAME Techathon 2.0 | 2022
  • APP_ENV production
  • DB_CONNECTION pgsql
  • APP_DEBUG false
  • APP_KEY base64:BASE_64_ENCODED_APP_KEY
  • DB_DATABASE postgres
  • DB_USERNAME postgres
  • DB_PASSWORD random-password-goes-here
  • DB_PORT 5432
@jdecode
jdecode / update_migrations_seq.sql
Created August 1, 2022 20:30
SQL to update the migrations table sequence, since the migrations were failing due to some DB mismatch (after importing data from different source) causing the max seq to be less than the data in the table, and having a conflicting primary key
select setval('migrations_id_seq', max(id) + 1, false) from migrations;
@jdecode
jdecode / enable-hot-corner-for-activities-in-ubuntu-20-04.md
Created March 25, 2022 21:12
Enable hot corner for activities (top-left) in Ubuntu 20.04
gsettings set org.gnome.desktop.interface enable-hot-corners true
@jdecode
jdecode / cloudbuild-with-cloud-run-on-gcp.md
Created January 20, 2022 12:51
Setup Cloud SQL with Cloud Run

Note : This is for Laravel/PHP setup only (should work with other stacks, but not tested)

  1. Setup a Cloud SQL instance
  2. Setup a Cloud Run service
  3. Connect the Cloud SQL instance to Cloud Run service under "connections"
  4. Add environment variables (directly or via secret manager) as per the specifications mentioned here: https://cloud.google.com/sql/docs/postgres/connect-run?authuser=1#connecting_to
  5. For Laravel, the DB_HOST ENV VAR should be of the format : /cloudsql/project-id:region-id:db-instane-name
  6. Additionally, add "Cloud SQL Client" role to the default compute account (Under IAM)
@jdecode
jdecode / ifttt.md
Created September 6, 2021 16:19
Testing Slack notification via IFTTT

This is a new thing I am testing.

  1. Subscribe to RSS/Atom feed of a username (jdecode in this case)
  2. Create a new applet in IFTTT that checks(via polling, every 5 minutes) if there is a new entry
  3. If there is a new entry, a notification will be sent to Slack
  4. If it works, then this post will be the first one that shows up in Slack
  5. After this, next step is to setup similar notifications from RSS/Atom feeds for GitHub/CircleCI/Heroku to end up in Slack

402270_mirror21