Skip to content

Instantly share code, notes, and snippets.

View jonathanrodriguezs's full-sized avatar

Jonathan Rodriguez jonathanrodriguezs

View GitHub Profile
@LuisEnMarroquin
LuisEnMarroquin / .bash_profile
Last active September 15, 2022 21:50
My bash aliases and functions
#!/bin/bash
CL_NULL='\e[0m'
CL_FAIL='\e[0;31m'
CL_NICE='\e[0;32m'
CL_WARN='\e[0;33m'
CL_BLUE='\e[0;34m'
CL_PURP='\e[0;35m'
CL_CYAN='\e[0;36m'
@kalpeshsingh
kalpeshsingh / pre-push
Last active April 26, 2024 04:31
A pre-push git hook that notify Amazon Chime group
#!/bin/sh
branch="$(git rev-parse --abbrev-ref HEAD)"
# get computer name to append in Chime message
username=$USER
# a branch name where you want to prevent git push. In this case, it's "master"
if [ "$branch" = "master" ]; then
echo "You can't commit directly to '"${branch}"' branch" # webstorm or intellij will show this as popup
@borekb
borekb / README.md
Last active August 10, 2022 14:14
Docker and Git Bash / MSYS2 on Windows: path conversion workaround

👋 Moved to https://github.com/borekb/docker-path-workaround


Docker in Git Bash / MSYS2 on Windows: path conversion workaround

UPDATE 07/2018: I switched from Git Bash to MSYS2 recently which should be very similar, if not the same, but there some subtle differences which made me realize this is more tricky than I thought and that I don't 100% understand what is going on. If someone can help, please let me know in the comments.

Invoking docker in MSYS2 shell or Git Bash typically fails with complains about paths, for example:

@deb1990
deb1990 / Readme.md
Last active February 20, 2021 21:11
SlashData

1. Prime Number

The 10001st Prime Number is 104743. Please find the code in primenumber.js file.

Technical Notes
  • In the code a cache is used to do the calculation more efficiently. When calculating the number for the 1st time, it takes around 23.35302734375ms, but if we run it again, it takes just 0.260986328125ms.
  • If next time we try to get the 10002nd prime number, The program will only calculate the 10002nd prime, because the previous 10001 numbers are already saved in the cache. This is again a huge performance benefit.

2. When would you choose a NoSQL database instead of a relational database and why?

  • In NoSQL each document can have its own unique structure. So when the schema of the data is not consistent and can change at any time, NoSQL is preferred. Its very flexible to add new kind of data without affecting existing data.
#!/bin/bash
# OPLOG_LIMIT: only include oplog entries before the provided Timestamp
# The timestamp is a unix timestamp
# If your desaster happened for example on 2017-18-10 12:20 and you want to restore until 12:19
# your timestamp is 'date -d "2017-10-18 12:19:00" +%s'
FULL_DUMP_DIRECTORY=$1
OPLOGS_DIRECTORY=$2
OPLOG_LIMIT=$3
@analogic
analogic / docker-compose.yml
Last active February 20, 2024 14:20
Poste.io (with Lets Encrypt) + Nginx reverse proxy + Nginx Lets encrypt companion
version: '3'
services:
nginx-proxy:
image: jwilder/nginx-proxy
labels:
com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true"
container_name: nginx-proxy
restart: unless-stopped
ports:
@soulmachine
soulmachine / jwt-expiration.md
Last active April 9, 2024 04:12
How to deal with JWT expiration?

First of all, please note that token expiration and revoking are two different things.

  1. Expiration only happens for web apps, not for native mobile apps, because native apps never expire.
  2. Revoking only happens when (1) uses click the logout button on the website or native Apps;(2) users reset their passwords; (3) users revoke their tokens explicitly in the administration panel.

1. How to hadle JWT expiration

A JWT token that never expires is dangerous if the token is stolen then someone can always access the user's data.

Quoted from JWT RFC:

@NigelEarle
NigelEarle / Knex-Setup.md
Last active March 28, 2024 09:11
Setup Knex with Node.js

Knex Setup Guide

Create your project directory

Create and initialize your a directory for your Express application.

$ mkdir node-knex-demo
$ cd node-knex-demo
$ npm init