Skip to content

Instantly share code, notes, and snippets.

View migrap's full-sized avatar

Michael Park migrap

View GitHub Profile

Visualize primary and replicas (inspired by Waterpark)

Mix.install([
  {:kino, "~> 0.16.1"}
], consolidate_protocols: false)

Library modules

@mirzap
mirzap / AccessToken.php
Created February 27, 2020 07:05 — forked from onamfc/AccessToken.php
Add Custom Claims to Passport 8 / Laravel 6
<?php
namespace App\Passport;
use App\User;
use Lcobucci\JWT\Builder;
use Lcobucci\JWT\Signer\Key;
use League\OAuth2\Server\CryptKey;
use Lcobucci\JWT\Signer\Rsa\Sha256;
use Laravel\Passport\Bridge\AccessToken as BaseToken;
@GriffinSauce
GriffinSauce / algolia-search-hook.js
Last active November 28, 2020 18:25
A hook and context for algoliasearch/lite
import React, { useState, useEffect, useContext, useRef } from 'react';
import algoliasearch from 'algoliasearch/lite';
const algoliaClient = algoliasearch(ALGOLIA_APP_ID, ALGOLIA_API_KEY);
const SHOW_LOADING_AFTER_MS = 300;
/**
* Initialize a search
*
* @example:
@onamfc
onamfc / AccessToken.php
Last active September 19, 2024 10:18
Add Custom Claims to Passport 8 / Laravel 6
<?php
namespace App\Passport;
use App\User;
use Lcobucci\JWT\Builder;
use Lcobucci\JWT\Signer\Key;
use League\OAuth2\Server\CryptKey;
use Lcobucci\JWT\Signer\Rsa\Sha256;
use Laravel\Passport\Bridge\AccessToken as BaseToken;
@ruizb
ruizb / advanced-example.md
Last active September 26, 2023 20:21
Reader monad example using fp-ts

The following section is not part of monet.js documentation, but I think it's worth showing how we can compose readers using fp-ts.

Reader composition

Let's say we have the following piece of code:

interface Dependencies {
  logger: { log: (message: string) => void }
 env: 'development' | 'production'
@marcan
marcan / smbloris.c
Last active November 22, 2022 08:32
SMBLoris attack proof of concept
/* SMBLoris attack proof-of-concept
*
* Copyright 2017 Hector Martin "marcan" <marcan@marcan.st>
*
* Licensed under the terms of the 2-clause BSD license.
*
* This is a proof of concept of a publicly disclosed vulnerability.
* Please do not go around randomly DoSing people with it.
*
* Tips: do not use your local IP as source, or if you do, use iptables to block
@alexandrnikitin
alexandrnikitin / AhoCorasickTree.cs
Created May 1, 2017 18:46
Aho-Corasick with some perf improvements
using System;
using System.Collections.Generic;
namespace Adform.AdServing.AhoCorasickTree.Sandbox.V7g
{
public class AhoCorasickTree
{
internal AhoCorasickTreeNode Root { get; set; }
public AhoCorasickTree(IEnumerable<string> keywords)
@OlegIlyenko
OlegIlyenko / Event-stream based GraphQL subscriptions.md
Last active April 29, 2026 22:22
Event-stream based GraphQL subscriptions for real-time updates

In this gist I would like to describe an idea for GraphQL subscriptions. It was inspired by conversations about subscriptions in the GraphQL slack channel and different GH issues, like #89 and #411.

Conceptual Model

At the moment GraphQL allows 2 types of queries:

  • query
  • mutation

Reference implementation also adds the third type: subscription. It does not have any semantics yet, so here I would like to propose one possible semantics interpretation and the reasoning behind it.

@NickCraver
NickCraver / Windows10-Setup.ps1
Last active March 1, 2026 11:53
(In Progress) PowerShell Script I use to customize my machines in the same way for privacy, search, UI, etc.
##################
# Privacy Settings
##################
# Privacy: Let apps use my advertising ID: Disable
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Type DWord -Value 0
# To Restore:
#Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Type DWord -Value 1
# Privacy: SmartScreen Filter for Store Apps: Disable
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost -Name EnableWebContentEvaluation -Type DWord -Value 0
@bleroy
bleroy / JsonHelpers.cs
Last active February 15, 2016 18:30
Helper methods for use with Newtonsoft's JSON library.
using Newtonsoft.Json;
using System.Collections.Generic;
namespace Bleroy
{
public static class JsonHelpers
{
/// <summary>
/// Advances the reader to the first child property with the provided name,
/// no matter how deep it is.