Skip to content

Instantly share code, notes, and snippets.

View abhisekp's full-sized avatar
🏠
Working from home

Abhisek Pattnaik abhisekp

🏠
Working from home
View GitHub Profile
@joepie91
joepie91 / random.md
Last active April 11, 2025 09:42
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

@abhisekp
abhisekp / # Variables Intro.md
Last active May 10, 2018 04:30
Variable Declarations in JavaScript — http://bit.ly/js-vars
@awalx
awalx / _Python.md
Last active April 18, 2017 14:15
Python Exercises

Python 3 Exercises

A few Python exercises.

Javascript The Good Parts - Crockford
Principles of Object Oriented JavaScript - Zakas // important
YDKJS - `this` part - Simpson
Prototypes in Javascript - https://sporto.github.io/blog/2013/02/22/a-plain-english-guide-to-javascript-prototypes/
JavaScript - Understanding the weird parts. Antony Alicea
Functional Programming in JavaScript - Practice : http://reactivex.io/learnrx/
NodeJS - Antony Alicea
Understanding ES6 - Zakas
Visualisation
@bearfrieze
bearfrieze / comprehensions.md
Last active December 23, 2023 22:49
Comprehensions in Python the Jedi way

Comprehensions in Python the Jedi way

by Bjørn Friese

Beautiful is better than ugly. Explicit is better than implicit.

-- The Zen of Python

I frequently deal with collections of things in the programs I write. Collections of droids, jedis, planets, lightsabers, starfighters, etc. When programming in Python, these collections of things are usually represented as lists, sets and dictionaries. Oftentimes, what I want to do with collections is to transform them in various ways. Comprehensions is a powerful syntax for doing just that. I use them extensively, and it's one of the things that keep me coming back to Python. Let me show you a few examples of the incredible usefulness of comprehensions.

@Masd925
Masd925 / #Some FCC one-liner solutions
Last active April 6, 2017 10:46
Some one-liner solutions on FCC exercises. Most are my own doing. Some picked from FCC chat.
Some FCC one-liner solutions
@koenbok
koenbok / advanced.md
Last active May 5, 2019 14:34
Learn Programming

Advanced Programming

Programming setup

  • Instant visual output.
  • Fast startup time, fast execution.
  • Sensible errors, with code locations.
  • Easy to set up and get working.

Architecture

@abhisekp
abhisekp / # FCC One Liner Solutions.md
Last active November 23, 2016 07:51
One Liner Solutions to FreeCodeCamp Challenges - http://j.mp/abhisekpFCCSolnsOneLiners
@abhisekp
abhisekp / gbot-min.js
Last active February 17, 2016 02:58
GitterBot
console.clear();
/* GLOBALS */
const GitterBot = {
config: {
roomId: '546fd572db8155e6700d6eaf', // FreeCodeCamp/FreeCodeCamp // <-- insert the room id
token: '', // <-- insert your user token (Get it from https://developer.gitter.im/apps)
}
};