Skip to content

Instantly share code, notes, and snippets.

🖖
Coding. Always.

huysentruitw huysentruitw

🖖
Coding. Always.
View GitHub Profile
@huysentruitw
huysentruitw / PasswordHasher.cs
Last active May 26, 2020
PasswordHasher class for generating and verifying secure password hashes
View PasswordHasher.cs
/*
* Copyright 2016-2020 Wouter Huysentruit
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
View chrome-offline-game.js
jump = () => {
const space = { bubbles: true, key: 'Space', keyCode: 32, charCode: 0 };
document.activeElement.dispatchEvent(new window.KeyboardEvent('keydown', space));
document.activeElement.dispatchEvent(new window.KeyboardEvent('keyup', space));
};
ctx = document.getElementsByClassName('runner-canvas')[0].getContext('2d');
detect = () => {
const data = ctx.getImageData(105, 125, 1, 1).data;
@huysentruitw
huysentruitw / nested-gql-resolvers.js
Last active Feb 24, 2020
Nested graphql resolvers with NodeJS
View nested-gql-resolvers.js
"use strict";
const express = require('express');
const express_graphql = require('express-graphql');
const { GraphQLSchema, GraphQLObjectType, GraphQLString } = require('graphql');
// GraphQL schema
const songType = new GraphQLObjectType({
name: 'SongType',
fields: {
@huysentruitw
huysentruitw / flash.cmd
Created Jan 26, 2020
Flash nanoframework to ESP32
View flash.cmd
nanoff --update --target ESP32_WROOM_32 --serialport COM3
@huysentruitw
huysentruitw / Program.cs
Created Jan 25, 2020
nanoFramework example code
View Program.cs
using System;
using System.Threading;
namespace NFApp1
{
public class Program
{
public static void Main()
{
Console.WriteLine("Hello world!");
@huysentruitw
huysentruitw / ESP32 firmware.log
Last active Jan 26, 2020
nanoFramework firmware upload
View ESP32 firmware.log
nanoFramework Firmware Flasher v1.2.0+d5d164cfbc
Copyright (C) 2019 nanoFramework project contributors
Connected to ESP32 ESP32D0WDQ6 (revision 1) with MAC address 30AEA42503B8
features WiFi, BT, Dual Core, Coding Scheme None
Flash information: manufacturer 0x200 device 0x16406 size 4MB
Trying to find ESP32_WROOM_32 in developement repository...OK
Downloading firmware package...OK
Updating to 1.4.0-preview.87
Erasing flash...OK
View gist:f6f10cc1e9a10f2ef9bd5ab18f0b4f47
class Program
{
static ConcurrentDictionary<string, string> dict = new ConcurrentDictionary<string, string>();
static void Main(string[] args)
{
var t1 = new Thread(() =>
{
dict.GetOrAdd("key1", x =>
{
You can’t perform that action at this time.