Skip to content

Instantly share code, notes, and snippets.

View nguyenhuutuananh's full-sized avatar
🛠️
Fighting

Tuân Anh Nguyễn nguyenhuutuananh

🛠️
Fighting
View GitHub Profile
@fernandoaleman
fernandoaleman / mysql-8.0-gpg-fix.md
Last active June 28, 2024 18:08
The GPG keys listed for the "MySQL 8.0 Community Server" repository are already installed but they are not correct for this package.

Problem

The GPG keys listed for the "MySQL 8.0 Community Server" repository are already installed but they are not correct for this package.

Solution

rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2023
@thimslugga
thimslugga / setup-docker-al2023.md
Last active June 28, 2024 05:09
Setup Docker on Amazon Linux 2023

Setup Docker on Amazon Linux 2023

The following guide is for setting up Docker with docker-compose v2 on Amazon Linux 2023. The steps are intendend for AL2023 on EC2 but should mostly work for the AL2023 VMs running on other hypervisors.

Install and configure Docker on Amazon Linux 2023

Check for new updates

Get the current release:

@npearce
npearce / install-docker.md
Last active June 5, 2024 20:07
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start
@soulmachine
soulmachine / jwt-expiration.md
Last active June 21, 2024 14:09
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:

@jesstelford
jesstelford / event-loop.md
Last active June 7, 2024 17:12
What is the JS Event Loop and Call Stack?

Regular Event Loop

This shows the execution order given JavaScript's Call Stack, Event Loop, and any asynchronous APIs provided in the JS execution environment (in this example; Web APIs in a Browser environment)


Given the code

@RadGH
RadGH / short-number-format.php
Last active April 9, 2024 11:28
Short Number Formatter for PHP (1000 to 1k; 1m; 1b; 1t)
<?php
// Converts a number into a short version, eg: 1000 -> 1k
// Based on: http://stackoverflow.com/a/4371114
function number_format_short( $n, $precision = 1 ) {
if ($n < 900) {
// 0 - 900
$n_format = number_format($n, $precision);
$suffix = '';
} else if ($n < 900000) {
@jkubacki
jkubacki / gist:e2dd904bd648b0bd4554
Created January 21, 2015 18:47
Mac uninstall elasticsearch
#!/usr/bin/env sh
# checks to see if running
launchctl list | grep elasticsearch
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
launchctl remove homebrew.mxcl.elasticsearch
pkill -f elasticsearch
@staltz
staltz / introrx.md
Last active June 29, 2024 15:58
The introduction to Reactive Programming you've been missing
@jmyrland
jmyrland / test.js
Last active January 19, 2024 18:51
Socket-io load test?
/**
* Modify the parts you need to get it working.
*/
var should = require('should');
var request = require('../node_modules/request');
var io = require('socket.io-client');
var serverUrl = 'http://localhost';