Skip to content

Instantly share code, notes, and snippets.

View drmarshall's full-sized avatar

drmarshall drmarshall

View GitHub Profile
@AurelienGasser
AurelienGasser / linkedin-recruiter.js
Created February 23, 2023 10:04
Auto-expand list of experience items, color items based on duration, strikethrough based on keyboard, hide previously seen candidates.
// LinkedIn recruiter search results highlighter.
// Paste into your browser's JavaScript console.
//
// Features:
// - Auto-expand experience items
// - Color experience items based on duration (red if less than 1 year, green if 2y+, etc)
// - Strike-through experience items containing certain keywords
// - Record profiles already seen in search results and hide them in subsequent searches (to enable, set config variable to true below)
//
// If you make improvements, feel free to reach out and I can merge them. <aurelien.gasser at gmail.com>
@link-boris
link-boris / db.ts
Created October 14, 2022 21:17
Prisma Client Setup + Middleware for soft deletes
import { PrismaClient } from '@prisma/client'
const dbClient = new PrismaClient({})
/*
* Middleware to replace hard deletes with soft deletes
* 1. deletes will update deletedAt column
* 2. finds and updates will filter out deletedAt rows
*/
dbClient.$use(async (params, next) => {
@jhihn
jhihn / tokenizer_serialization.py
Last active April 20, 2020 00:21
Keras Tokenizer Gist
# Keras tokenizer lacks serialization. Therefore I created the below to address this without changing the API.
# (Since I don't know how long it'll take for keras to support it)
# The Tokenizer __init__ should be modified to take the word_stats dictionary as a kwarg,
# and a method added to the class to return the stats
# Expiermentally this works, but I am not sure of any nuances in the Tokenizer class.
def test_tokenizer():
texts = ["It was the best of times, it was the worst of times, it was the age of wisdom",
"it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, ",
"it was the season of Light, it was the season of Darkness, it was the spring of hope, ",
@nigeljyng
nigeljyng / AttentionWithContext.py
Last active February 10, 2021 14:02 — forked from cbaziotis/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
@cbaziotis
cbaziotis / AttentionWithContext.py
Last active April 25, 2022 14:37
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"
def dot_product(x, kernel):
"""
Wrapper for dot product operation, in order to be compatible with both
Theano and Tensorflow
Args:
x (): input
kernel (): weights
Returns:
"""
if K.backend() == 'tensorflow':
@cbaziotis
cbaziotis / Attention.py
Last active March 28, 2023 11:50
Keras Layer that implements an Attention mechanism for temporal data. Supports Masking. Follows the work of Raffel et al. [https://arxiv.org/abs/1512.08756]
from keras import backend as K, initializers, regularizers, constraints
from keras.engine.topology import Layer
def dot_product(x, kernel):
"""
Wrapper for dot product operation, in order to be compatible with both
Theano and Tensorflow
Args:
#import "TSTapstream.h"
#define MIXPANEL_TOKEN @"YOUR_MIXPANEL_TOKEN"
// ...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[Mixpanel sharedInstanceWithToken:MIXPANEL_TOKEN];
@MattFaus
MattFaus / mixpanel_funnels.py
Created January 2, 2014 23:03
A function to programmatically build and query funnel data via the MixPanel API.
class MixPanel(object):
def get_page_view_funnel(self, content_urls):
# Build up the events array. Each "event" is a step in the funnel
events = []
for cu in content_urls:
events.append({
"event": "Page View",
"selector": 'properties["Page View Page"] == "%s"' % (cu,),
})