Skip to content

Instantly share code, notes, and snippets.

View Dev-Dipesh's full-sized avatar

Dipesh Bhardwaj Dev-Dipesh

  • The Contentment Foundation
  • San Francisco, California
View GitHub Profile
@Dev-Dipesh
Dev-Dipesh / image.md
Last active May 10, 2024 07:10
Javascript loops can be quite confusing. Knowing the write loop to use can make a big difference in performance.

A4 Image file if you would like to print it ♥ JS Loops Cheatsheet

@Dev-Dipesh
Dev-Dipesh / rabbitmq_notes.md
Last active May 5, 2024 02:09
Why RabbitMQ is better over Redis and notes on RabbitMq.

Redis is Database whereas RabbitMQ was designed as a message router or message-orientated-middleware (mom), so I'm sure if you look for benchmarks, you'll find that RabbitMQ will outperform Redis when it comes to message routing.

RabbitMQ is written in Erlang which was specifically designed by the telecom industry to route messages, you get clustering out of the box due to it being written in Erlang which means in a clustered environment, RabbitMQ will outperform Redis even further.

Furthermore, you get guaranteed delivery of messages due to the AMQP protocol, in other words, if the network drops while consuming the message, the consumer won't be able to say thanks for the message, so the consumer will drop the message and Rabbit will requeue the message, if you publish a message and the queue didn't say thanks to the publisher due to network problems or timeouts, Rabbit will drop the message and the publisher will keep on trying to publish the message. You can have publish retries with backoff policies, so

@Dev-Dipesh
Dev-Dipesh / google-cloud-spanner-true-time.md
Created April 27, 2024 09:27
Google Cloud Spanner Transaction Commit Explanation with an Example

Google Cloud Spanner Transaction Commit using True Time API

Mermaid Diagram

Imagine you're organizing a surprise party (a transaction) that needs to happen precisely at 5 PM (the commit time). However, all your friends (the database nodes) have slightly different watches, and you can't trust them to be perfectly synchronized. To avoid the surprise being ruined by someone arriving early or late, you decide to use a special app (TrueTime) that allows everyone to agree on a time window when 5 PM will definitely occur, say between 4:59 PM and 5:01 PM.

You tell your friends to be ready and in position anytime within that window, but the surprise will only start exactly at 5 PM, as determined by the app. Because of the app's accuracy, you're confident that no one will act before 4:59 PM or after 5:01 PM, and since everyone prepares in advance, the party kicks off flawlessly at 5 PM without further coordination needed. This is akin to how Spanner uses TrueTime to set a global commit timestamp that ensures all

Clark-Wilson Model

The Clark-Wilson model is a security framework designed to ensure that computer systems process transactions securely and maintain data integrity. It revolves around two main concepts:

  1. Constrained Data Items (CDIs): These are sensitive data elements that must be protected to ensure they remain accurate and reliable. The model ensures that CDIs can only be modified through specific, authorized procedures.
  2. Transformation Procedures (TPs): These are the only processes that can change CDIs. Each TP must be certified to meet certain integrity conditions, ensuring they only manipulate data in allowed ways.

In practical terms, the model requires users to be authenticated before accessing the system and ensures they have permission to execute TPs. It monitors and logs all transactions, both successful and those denied due to integrity issues or unauthorized access attempts. This framework is particularly useful in environments requiring strict audit capabilities and rigorous data integrit

@Dev-Dipesh
Dev-Dipesh / nginx-ssl.md
Last active April 27, 2024 07:37
Setting SSL/TLS in Nginx Using Godaddy as CA Provider

CA PROVIDER - GODADDY

Certificates

Ones you have generated, downloaded and extracted the certificate zip, you will find 2 files in it:

  • gd_bundle-g2-g1.crt Intermediate Certificate
  • RANDOM_NUM.crt Your SSL Certificate

Creating single chained certificate

CleanShot 2024-04-26 at 21 05 31@2x

Hack for the Game

Remember to change the query selector before running the script in your browser.

Laymen Explanation

  • Game Character = sleeping emoji
  • Obstacle = Notification emoji

Here's what each part of the code does:

@Dev-Dipesh
Dev-Dipesh / seed.ts
Last active April 18, 2024 13:58
Project: Evento
import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient();
const events = [
{
id: 1,
name: "DJ Practice Session",
slug: "dj-practice-session",
city: "Austin",
@Dev-Dipesh
Dev-Dipesh / ELK with Nginx.md
Last active January 24, 2024 14:34
Setting up Elasticsearch, Logstash and Kibana with Nginx.

ELK (Elasticsearch Logstash Kibana)

Though we're focused more on server setup procedure in this document, I will still give a very brief explanation in laymen terms for ELK. To those who are starting new in this stack, must have already heard of MVC (Model View Controller), so take it like this:

  • Model => Elasticsearch (for Storage, Indexing & Search)
  • View => Kibana (for DataViz & G-Man, yeah the one in half life 😏)
  • Controller => Logstash (For Logs & Filtering)

Embracing Secure Remote Work: Exploring the Synergy of VDI, VPN, RBI, and Zero Trust Technologies

In this Gist, I've shared two tables that outline the steps and technologies involved in creating a secure remote work environment using VDI, VPN, RBI, and other security measures. The first table is a 6-step user journey highlighting risks and mitigation strategies. The second table presents additional steps and technologies to create a Zero Trust remote work environment.

VDI (Virtual Desktop Infrastructure): VDI is a virtualization technology that allows users to access a fully functional desktop environment remotely. It creates virtual machines on a centralized server, each running a separate operating system instance. Users can access these virtual desktops from their devices using a remote desktop protocol. VDI helps enhance security by keeping sensitive data within the data center, simplifying patch management, and providing centralized control over user access.

RBI (Remote Browser Isolation):

Challenge Solutions

  1. Secret Key: F5LABS4445663337899
  2. Coded: F5LABS7776888678123
  3. UI Checks: F5LABS3425563334219
  4. Authorization Mess: F5LABS34255676246218
  5. Version Trouble: F5LABS0099876655774
  6. Bypass Controls: F5LABS9899877665588
  7. Weak Tokens: F5LABS1116536788549
  8. Credentials Stuff: F5LABS4445663337899, F5LABS8387288577236