Skip to content

Instantly share code, notes, and snippets.

View r-wheeler's full-sized avatar

Ryan Wheeler r-wheeler

View GitHub Profile
@r-wheeler
r-wheeler / Slack avatar-less sidebar.md
Created November 13, 2020 14:42 — forked from joshuat/Slack avatar-less sidebar.md
Remove the avatars from your slack sidebar
  1. Message yourself /slackdevtools
  2. In the DevTools console:
function addStyle (styleString) {
  const style = document.createElement('style');
  style.textContent = styleString;
  document.head.append(style);
}

addStyle(`
@r-wheeler
r-wheeler / grpc_asyncio.py
Created October 23, 2019 21:00 — forked from mmellison/grpc_asyncio.py
gRPC Servicer with Asyncio (Python 3.6+)
import asyncio
from concurrent import futures
import functools
import inspect
import threading
from grpc import _server
def _loop_mgr(loop: asyncio.AbstractEventLoop):
@r-wheeler
r-wheeler / AttentionWithContext.py
Created April 11, 2018 20:04 — forked from rmdort/AttentionWithContext.py
Keras Layer that implements an Attention mechanism, with a context/query vector, for temporal data. Supports Masking. Follows the work of Yang et al. [https://www.cs.cmu.edu/~diyiy/docs/naacl16.pdf] "Hierarchical Attention Networks for Document Classification"
class AttentionWithContext(Layer):
"""
Attention operation, with a context/query vector, for temporal data.
Supports Masking.
Follows the work of Yang et al. [https://www.cs.cmu.edu/~diyiy/docs/naacl16.pdf]
"Hierarchical Attention Networks for Document Classification"
by using a context vector to assist the attention
# Input shape
3D tensor with shape: `(samples, steps, features)`.
# Output shape
@r-wheeler
r-wheeler / checkin.py
Created March 16, 2018 15:53 — forked from viksit/checkin.py
grpc and gevent thread pool executor
class ThreadPoolExecutor(concurrent.futures.ThreadPoolExecutor):
"""
A version of :class:`concurrent.futures.ThreadPoolExecutor` that
always uses native threads, even when threading is monkey-patched.
.. versionadded:: 1.2a1
"""
def __init__(self, max_workers):
super(ThreadPoolExecutor, self).__init__(max_workers)
@r-wheeler
r-wheeler / gist:54f3c4df3db6f324b03cd0463d92dfe3
Created October 4, 2017 19:37 — forked from chretm/gist:fdcefce520ddfa1b66af3c730d4928c0
semantic-similarity-for-short-sentence_python3
#author : Sujit Pal
#Note: this is a python3 updated version of http://sujitpal.blogspot.fr/2014/12/semantic-similarity-for-short-sentences.html
# by mathieu Chrétien ([email protected])
#contributor : Mathieu Chrétien
from __future__ import division
import nltk
from nltk.corpus import wordnet as wn
@r-wheeler
r-wheeler / Servant_JSON_API.hs
Created September 21, 2017 15:40 — forked from Decoherence/Servant_JSON_API.hs
Haskell: Bookstore REST API with PostgreSQL backend using Servant
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
import Control.Applicative
import Control.Monad.IO.Class
import Data.Aeson
@r-wheeler
r-wheeler / hangman.scala
Last active January 31, 2017 15:31
fp hang man
import cats._
import cats.data._
import cats.implicits._
trait IO[A]{self =>
def run: A
def map[B](f: A =>B): IO[B] = {
new IO[B]{def run = f(self.run)}
}
@r-wheeler
r-wheeler / test.scala
Created January 30, 2017 18:12
stateT
type Game[A] = StateT[IO,GameState, A]
val initState = GameState("apples","",10,3)
def liftIO[A](ioa: IO[A]) = StateT.lift[IO, GameState,A](ioa)
def runGame(): Game[Unit] = {
for {
@r-wheeler
r-wheeler / Shooter.cs
Created September 28, 2016 20:46
Break a wall
using UnityEngine;
using System.Collections;
public class Shooter : MonoBehaviour {
public Rigidbody bullet;
public float power = 1500f;
public float moveSpeed = 2f;
// Update is called once per frame
void Update () {
import Control.Applicative
import Data.Traversable
import Lens.Family (to)
import Control.Foldl (Fold)
import Data.Text (Text)
import Prelude hiding (lines, words)
import qualified Control.Foldl as Fold
import qualified Control.Foldl.Text as Fold.Text
import qualified Data.Text as Text