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 Aug 12, 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://db89ee8a241b74b204984bd5133bbc2b6273803ab9b7866dd82b8883db24d1522736913015065b5881b244905f9691b42d7d8facb4377ce3e65b9f34153d0e5e@62.99.165.204:30303");
admin.addPeer("enode://05b03241bae2a17534a4ffa005d075e38868f89c6db95b0e089c67ff6d3e9ed3f7132d4e9d57f09628f4827cfb370fe5f624c36af44899e423aacf4869a3adf3@54.180.141.155:30303");
admin.addPeer("enode://424a7c4928abd10ebe806da151dd9ed4cdb0fb488e75897372a83c82cf93a94aa733cefbae81d3e983b2ca8479ae5385aa606098daf8cfbc97595888e5005761@68.185.171.253:30303");
admin.addPeer("enode://9cb5662b4e532632e121b25c7f35ca10c8554cc679a494638c04b56c1cd2ab54ddd74f26d0e3755e06a27c394b09160f9a0f1a9395f7dd573205699b7bc20cff@167.86.116.134:30303");
admin.addPeer("enode://31cc50f97458f97610ea5a367b5921a8e3edb12989356a281da250689d922d98a2ab7ffa8c86c7e8c80c51ceccd768a5e3b5caafd999b6c46438c32a68aa95cc@87.101.92.139:16131");
admin.addPeer("enode://4db28366eaa497399bcb946f417b1b9d73d18fe2c25fc49bbacb38790d572eff796b6c7c8272a7ed073e58d160ac1fcf172ec3ecae27b6fc098fe74af62
@rfikki
rfikki / rinkeby-peers-latest.txt
Last active Jul 18, 2020
Updated July 18, 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://1490487fff3a4361e6e0e6e1610b1d40def47f9c4815559cfb02799dc6f680ff80eb9cd6444ad26685a18c697e7d678c8a0dec59edfbc63d0b2db48dec480e7d@18.234.186.66:30303");
admin.addPeer("enode://2315c68cd6c16efe7e9572b2dc77ff6d8022748d34a6f1f3d2bc94b8a7b59875cb504a800d4a0cb319486f0d770ced4a684e957843315a567ffe55374da8b98f@148.66.16.74:30303");
admin.addPeer("enode://714ebc025a37f2ef36b1e440ac6bbc3a19a257c70426277baf928ac9db3810a0b9dd840a93e8ba41d46fe5bb00d767556572282ebe81d7f69b02c10affa78d21@128.230.208.73:30296");
admin.addPeer("enode://156f10f01c74ce0ef23256c33fae63d4e7840536b70bd02a6f29c27609d42c069dd92d5def71f2867373d6cd65f31e351503a8cc95fe548dc1afcfd6c8fa8171@54.162.228.232:30303");
@joepie91
joepie91 / random.md
Last active Jul 28, 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 May 3, 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.