Skip to content

Instantly share code, notes, and snippets.

import { loadSync, Options } from '@grpc/proto-loader'
import { PackageDefinition } from 'grpc'
const ProtoBaseDir = process.env.JETSETTER_SCHEMAS_PATH || `${__dirname}/../../../schemas`
const DefaultLoadOptions = {
keepCase: true,
longs: String,
enums: String,
defaults: false,
@theorm
theorm / Dockerfile
Last active October 13, 2025 04:10
Serve a fairseq summary model as an API
FROM python:3.6.6-slim
WORKDIR /fia
RUN apt-get update
# the big one
RUN pip install torch
RUN apt-get install -y --no-install-recommends build-essential wget
@theorm
theorm / .gitconfig
Last active January 19, 2020 15:48
[user]
email = xxx@yyy.com
[alias]
# View the SHA, description, and history graph of the latest 20 commits
l = log --pretty=oneline -n 20 --graph
lg = log -p
lol = log --graph --decorate --pretty=oneline --abbrev-commit
lola = log --graph --decorate --pretty=oneline --abbrev-commit --all
ls = ls-files
" Make Vim more useful
set nocompatible
" Use the OS clipboard by default (on versions compiled with `+clipboard`)
set clipboard=unnamed
" Enhance command-line completion
set wildmenu
" Allow cursor keys in insert mode
set esckeys
" Allow backspace in insert mode
set backspace=indent,eol,start
# Create a new directory and enter it
function mkd() {
mkdir -p "$@" && cd "$@"
}
# Determine size of a file or total size of a directory
function fs() {
if du -b /dev/null > /dev/null 2>&1; then
local arg=-sbh
else
from flair.data import Sentence
from flair.models import SequenceTagger
tagger = SequenceTagger.load('ner')
filename = 'ts.txt'
out_filename = 'ts_with_entities.txt'
cnt = 0
with open(filename) as f:
<script>
export default {
name: 'test-component',
functional: true,
props: {
children: Array
},
render (h, context) {
return (context.props.children || []).map(child => {
if (typeof child === 'string') return child
@theorm
theorm / cantons.geojson
Last active March 23, 2020 17:38
Lu Geojson
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import itertools
def dict_product(dicts):
"""
Cartesian product.
See https://stackoverflow.com/questions/5228158/cartesian-product-of-a-dictionary-of-lists
>>> list(dict_product(dict(number=[1,2], character='ab')))
[{'character': 'a', 'number': 1},
{'character': 'a', 'number': 2},