Skip to content

Instantly share code, notes, and snippets.

View mcgwiz's full-sized avatar

Mike McGranahan mcgwiz

View GitHub Profile

Windows 10 - Using Git Bash With TMUX

Why Not Use WSL?

I tried the WSL and it isn't quite seamless enough for me. I ran in to problems when editing in VSCode and having watchers on my files (ng serve, dotnet watch run, etc.). In addition, I kept running in to problems that only manifest themselves when running in WSL. For example, this issue with doing production builds and the terser plugin has made many a developer rage-quit on using WSL. Just figuring out that it was an issue with the WSL took a lot of time.

That terser plugin issue was never resolved and I ended up having to keep a git bash window open in addition to my WSL console window so I could do production builds. To make matters worse, my npm packages were platform-dependent so I couldn't use the same project folder. So, my procedure was: commit whatever changes to test branch, push to repo, git pull on my "windows" project folder, and do a production build there

ayan4m1 /
Last active February 2, 2023 01:00
How to build Redis Desktop Manager -

Redis Desktop Manager for Windows

Yes, it's been done already. No, it's still not particularly easy. You do not need to use either Qt Creator or VS2015.

I am building on information found here, here, and here. Thanks to these folks and the contributors to RDM.

With this document, I sought to "trim the fat" from these other guides and prove that VS2015 itself was not in fact necessary - just its tooling.


gregkorossy / semaphore.js
Last active September 15, 2023 08:08
A simple implementation of a semaphore in JS
function Semaphore(max) {
var counter = 0;
var waiting = [];
var take = function() {
if (waiting.length > 0 && counter < max){
let promise = waiting.shift();
rfikki / rinkeby-peers-latest.txt
Last active December 9, 2020 04:21
joepie91 /
Last active April 10, 2024 18:45
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

lukin0110 /
Last active October 26, 2020 00:36
Gulp + browserify + babelify + react

Use React with Gulp, Browserify and Babelify. This allows you to use React in jsx & node.js style. It let's you use require('module') in your JavaScript. Babelify will transform the jsx code to JavaScript code.


gulp build-react

This will generate a main.min.js file in the build directory with sourcemaps.


cmatskas / pbkdf2dotnetsample.cs
Last active March 3, 2018 09:39
Pbkdf2 .NET Sample
public class PasswordHash
public const int SaltByteSize = 24;
public const int HashByteSize = 20; // to match the size of the PBKDF2-HMAC-SHA-1 hash
public const int Pbkdf2Iterations = 1000;
public const int IterationIndex = 0;
public const int SaltIndex = 1;
public const int Pbkdf2Index = 2;
public static string HashPassword(string password)
module Person =
open System
type PersonState = private { id: Guid; name: string; age: int}
let createPerson id name age = {id = id; name = name; age = age}
let changeName name personState = {personState with name = name}
let changeAge age personState =
// some crazy business rule involving age
{personState with age = age}
module SomeOtherModule =