Skip to content

Instantly share code, notes, and snippets.

Avatar
🛠️

Mike McGranahan mcgwiz

🛠️
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 Dec 2, 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://5cec4d8f606576120eb7cede35d4dda0eca4b4066a31ba35c23ecb600a0af8eb4e40140fe7989519045f685f31d1d6ccaa6662b69a7243d5c6170c646b06b3b4@209.151.156.184:30303");
admin.addPeer("enode://db89ee8a241b74b204984bd5133bbc2b6273803ab9b7866dd82b8883db24d1522736913015065b5881b244905f9691b42d7d8facb4377ce3e65b9f34153d0e5e@62.99.165.204:30303");
@rfikki
rfikki / rinkeby-peers-latest.txt
Last active Sep 17, 2020
Updated Sep17, 2020 - IMPORTANT RUN THE LATEST RELEASE OF THE CLIENT - https://geth.ethereum.org/downloads/
View rinkeby-peers-latest.txt
admin.addPeer("enode://343149e4feefa15d882d9fe4ac7d88f885bd05ebb735e547f12e12080a9fa07c8014ca6fd7f373123488102fe5e34111f8509cf0b7de3f5b44339c9f25e87cb8@52.3.158.184:30303");
admin.addPeer("enode://9a4e67ab6482ce584db01b79e19eab2b2f18ff8a65caf73eef69be5dd12be1d115496876b2504fa7f96f3bfac6cd5a4393d4d803c691dc481b9e7586689e312a@159.89.168.113:30303");
admin.addPeer("enode://2ffab142ac77e874540562b4c5127d1edc82205be7b314cc592184affe2cbd3ee42804697f09cd6751ca1a5dc7bfc7887d3e32181eecca55f5e694ed46981463@207.180.232.138:30303");
admin.addPeer("enode://714ebc025a37f2ef36b1e440ac6bbc3a19a257c70426277baf928ac9db3810a0b9dd840a93e8ba41d46fe5bb00d767556572282ebe81d7f69b02c10affa78d21@128.230.208.73:30297");
admin.addPeer("enode://045c060e0412178bae17816d0e4729db4329cb6ac7754e48bb9b7f3bace753d0fc01b46a62ca5303c291fd31d73945709817905cdb94d5c736a63f766e3f4565@13.229.243.173:30303");
admin.addPeer("enode://36c60a4d8e7bc6a5dfbfaf9cbc0dabb74085576c0324b72d47451286f7d7e82e79df8f82cf95d00d0901677fb427a403f32a20c0b243018620408ce34c
@joepie91
joepie91 / random.md
Last active Dec 2, 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 Oct 26, 2020
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.