Skip to content

Instantly share code, notes, and snippets.

🛠

Mike McGranahan mcgwiz

🛠
Block or report user

Report or block mcgwiz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View BUILDING-RDM.md

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.

Prerequisites

@Gericop
Gericop / semaphore.js
Last active Feb 24, 2020
A simple implementation of a semaphore in JS
View semaphore.js
function Semaphore(max) {
var counter = 0;
var waiting = [];
var take = function() {
if (waiting.length > 0 && counter < max){
counter++;
let promise = waiting.shift();
promise.resolve();
}
View lightclient-peers-mainnet-latest.txt
admin.addPeer("enode://424a7c4928abd10ebe806da151dd9ed4cdb0fb488e75897372a83c82cf93a94aa733cefbae81d3e983b2ca8479ae5385aa606098daf8cfbc97595888e5005761@68.185.171.253:30303");
admin.addPeer("enode://9cb5662b4e532632e121b25c7f35ca10c8554cc679a494638c04b56c1cd2ab54ddd74f26d0e3755e06a27c394b09160f9a0f1a9395f7dd573205699b7bc20cff@167.86.116.134:30303");
admin.addPeer("enode://e96b6419197c7a145a012e2bcc98247f3b52969e4a22a4cf62079726c636b0743b0982295a36d5fa8b6bb80224aeef8f73e711804a8225db5a01c16f7cee5f34@89.172.77.163:30303");
@rfikki
rfikki / rinkeby-peers-latest.txt
Last active Mar 17, 2020
Updated FEB 27, 2020 - IMPORTANT RUN THE LATEST RELEASE OF THE CLIENT - https://geth.ethereum.org/downloads/
View rinkeby-peers-latest.txt
admin.addPeer("enode://b920d3f9d2a3333dba7d2df8c655974ade36e435bca315ca8b9b307b0f4b4b8aae1004759755e8fc63d4b4d0e5a5452137896de9c141fdb244a65800c26d9df5@104.207.131.9:30388");
admin.addPeer("enode://a9ed8d7b0cafdc2a30813b0758febe6e94d2a3a625644b6b5854d4463083b060de0bfbf1681811432487c761064c13d854e33ce203b964e28fea3fb866345fde@138.197.108.157:30303");
@joepie91
joepie91 / random.md
Last active Apr 1, 2020
Secure random values (in Node.js)
View random.md

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
lukin0110 / GulpReactBrowserifyBabelify.md
Last active Aug 7, 2019
Gulp + browserify + babelify + react
View GulpReactBrowserifyBabelify.md

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.

Development

gulp build-react

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

Production

View pbkdf2dotnetsample.cs
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)
View ConfusedDDD.fs
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 =
View nextTick.js
// Only add setZeroTimeout to the window object, and hide everything
// else in a closure.
(function() {
var timeouts = [];
var messageName = "zero-timeout-message";
// Like setTimeout, but only takes a function argument. There's
// no time argument (always zero) and no arguments (you have to
// use a closure).
function setZeroTimeout(fn) {
You can’t perform that action at this time.