Skip to content

Instantly share code, notes, and snippets.

View akhilome's full-sized avatar
🌚
poupon

Kizito Akhilome akhilome

🌚
poupon
View GitHub Profile
@aleclarson
aleclarson / rollup-typescript.md
Last active June 21, 2024 03:25
The best Rollup config for TypeScript libraries

Features

🔥 Blazing fast builds
😇 CommonJS bundle
🌲 .mjs bundle
.d.ts bundle + type-checking
🧐 Source maps

Install

@winadiw
winadiw / django_deploy.md
Created November 18, 2018 14:30 — forked from bradtraversy/django_deploy.md
Django Deployment - Digital Ocean

Django Deployment to Ubuntu 18.04

In this guide I will go through all the steps to create a VPS, secure it and deploy a Django application. This is a summarized document from this digital ocean doc

Any commands with "$" at the beginning run on your local machine and any "#" run when logged into the server

Create A Digital Ocean Droplet

Use this link and get $10 free. Just select the $5 plan unless this a production app.

@nakov
nakov / AES-256-CTR-Argon2-HMAC-SHA256-example.js
Last active May 30, 2024 14:31
Cryptography for JavaScript Developers: Hashes, HMAC, PBKDF2, Scrypt, Argon2, AES-256-CTR, ECDSA, EdDSA, secp256k1, Ed25519
const aes = require("aes-js");
const argon2 = require("argon2");
const crypto = require("crypto");
const cryptoJS = require("crypto-js");
// Encrypt using AES-256-CTR-Argon2-HMAC-SHA-256
async function aes256ctrEncrypt(plaintext, password) {
let argon2salt = crypto.randomBytes(16); // 128-bit salt for argon2
let argon2Settings = { type: argon2.argon2di, raw: true,
timeCost: 8, memoryCost: 2 ** 15, parallelism: 2,
@winadiw
winadiw / webdev_online_resources.md
Created July 31, 2018 05:53 — forked from bradtraversy/webdev_online_resources.md
Online Resources For Web Developers (No Downloading)
@shrekuu
shrekuu / fixing-locale-error-on-ubuntu-server-14-and-16.sh
Last active July 24, 2021 11:15
fixed: manpath: can't set the locale; make sure $LC_* and $LANG are correct
# I know you've got stuck for too long ^_^Y
# Locale is not configured correct. I don't know what broke that. Maybe time did.
# I fixed it on my ubuntu 14 & 16 servers.
# Follow the steps below or run this script on your machine.
# step 1
# ensure this line in `/etc/default/locale` file and `/etc/environment` file
# LANG="en_US.UTF-8"
sudo echo '\nLANG="en_US.UTF-8"' >> /etc/default/locale && /etc/environment
@blairg
blairg / index.js
Created December 22, 2017 23:58
Mock event.preventDefault() with Jest
static async handleDelete(event) {
let success = true;
await Axios.delete('/todos')
.then(() => {})
.catch(error => {
success = false;
console.error(error);
});
@laurenfazah
laurenfazah / authentication_with_express_postgres.md
Last active July 13, 2024 16:51
Authentication with an Express API and Postgres

Authentication with an Express API and Postgres

Setting Up

Let's make sure our Express app has the required base modules:

# within root of API
npm install --save express pg knex bcrypt
npm install --save-dev nodemon

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@joepie91
joepie91 / random.md
Last active July 13, 2024 16:15
Secure random values (in Node.js)

Not all random values are created equal - for security-related code, you need a specific kind of random value.

A summary of this article, if you don't want to read the entire thing:

  • Don't use Math.random(). There are extremely few cases where Math.random() is the right answer. Don't use it, unless you've read this entire article, and determined that it's necessary for your case.
  • Don't use crypto.getRandomBytes directly. While it's a CSPRNG, it's easy to bias the result when 'transforming' it, such that the output becomes more predictable.
  • If you want to generate random tokens or API keys: Use uuid, specifically the uuid.v4() method. Avoid node-uuid - it's not the same package, and doesn't produce reliably secure random values.
  • If you want to generate random numbers in a range: Use random-number-csprng.

You should seriously consider reading the entire article, though - it's