Skip to content

Instantly share code, notes, and snippets.

@cristiano74
cristiano74 / apply_model_ner.py
Last active January 31, 2019 06:35
apply_model_ner: quick and dirty way to apply a spacy NER model to a JSONL file (prodigy.ai)
def apply_model_ner(source,spacy_model):
"""
source: "./data/T_4_slot_1.jsonl"
spacy_model="./model_T_2_1"
example --> apply_model_ner("./data/T_4_slot_1.jsonl","./model_T_2_1")
"""
from prodigy.components.loaders import JSONL
import copy
import spacy
@phizaz
phizaz / async.py
Last active April 3, 2024 15:44
Python turn sync functions to async (and async to sync)
import functools
def force_async(fn):
'''
turns a sync function to async function using threads
'''
from concurrent.futures import ThreadPoolExecutor
import asyncio
pool = ThreadPoolExecutor()

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@cboddy
cboddy / pre-commit
Last active December 3, 2019 00:09
pre-commit git hook for python projects to run autopep8 linter
#!/bin/bash
# run autopep8 linter on any python files that are part of the commit
# and modify them in-place to conform to pep8
git diff --cached --name-only | egrep '\.py$' | xargs --no-run-if-empty autopep8 -ri
# re-index files staged for commit
git diff --cached --name-only | egrep '\.py$'| xargs -l git add
@newyankeecodeshop
newyankeecodeshop / KendoGrid.js
Created July 7, 2014 16:03
New KendoGrid w/ selection support
/** @jsx React.DOM */
define([
'underscore', 'jquery', 'react', 'kendo'
], function (_, $, React, kendo) {
'use strict';
void kendo;
var PropTypes = React.PropTypes;
function isCellSelection(selectable) {
@mikaelbr
mikaelbr / destructuring.js
Last active April 25, 2024 13:21
Complete collection of JavaScript destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];
@wsargent
wsargent / docker_cheat.md
Last active August 31, 2023 12:10
Docker cheat sheet