This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# Public Domain CC0 license. https://creativecommons.org/publicdomain/zero/1.0/ | |
# Install requirements: | |
# composer require ifsnop/mysqldump-php | |
# composer require google/cloud-storage | |
require_once __DIR__ . '/vendor/autoload.php'; | |
require_once __DIR__ . '/config.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The documentation for Gerrit when it comes to formatting comments is quite lacking. Here is short list created by trial and error and looking at the source code in: | |
./gerrit-gwtexpui/src/main/java/com/google/gwtexpui/safehtml/client/SafeHtml.java | |
Lists: | |
* List item 1 | |
* List item 2 | |
- List item 1 | |
- List item 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible | |
filetype off | |
" Plug is installed with https://github.com/junegunn/vim-plug | |
"call plug#begin() | |
"Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } | |
"Plug 'vim-airline/vim-airline' | |
"Plug 'ctrlpvim/ctrlp.vim' | |
"Plug 'Yggdroot/indentLine' | |
" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Public Domain CC0 license. https://creativecommons.org/publicdomain/zero/1.0/ | |
-- Calculate the probability of k successes for n trials with probability of success k, | |
-- using the binomial distribution. | |
-- Calculate the binomial coefficient using the "multiplicative formula" | |
CREATE OR REPLACE FUNCTION functions.binomial_coef(n INT64, k INT64) AS (( | |
-- k!/(n!*(n-k)!) | |
-- We're going to have a hard time doing factorials here, | |
-- but based on the "multiplicative formula" in Wiki, it should be possible: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Public Domain CC0 license. https://creativecommons.org/publicdomain/zero/1.0/ | |
class Tokenizer { | |
constructor(config = {}) { | |
this.filters = config.filters || /[\\.,/#!$%^&*;:{}=\-_`~()]/g; | |
this.lower = typeof config.lower === 'undefined' ? true : config.lower; | |
// Primary indexing methods. Word to index and index to word. | |
this.wordIndex = {}; | |
this.indexWord = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Public Domain CC0 license. https://creativecommons.org/publicdomain/zero/1.0/ | |
"""MongoDB Apache Beam IO utilities. | |
Tested with google-cloud-dataflow package version 2.0.0 | |
""" | |
__all__ = ['ReadFromMongo'] | |
import datetime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
### BEGIN INIT INFO | |
# Provides: uwsgi-emperor | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the uwsgi emperor app server | |
# Description: starts uwsgi emperor app server using start-stop-daemon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Global LRU caching utility. For that little bit of extra speed. | |
The caching utility provides a single wrapper function that can be used to | |
provide a bit of extra speed for some often used function. The cache is an LRU | |
cache including a key timeout. | |
Usage:: | |
import cache | |
@cache.memoize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Public Domain CC0 license. https://creativecommons.org/publicdomain/zero/1.0/ | |
# Prepare with: pip install fasttext | |
# Tested with Python 3.9 | |
import urllib.request | |
import fasttext | |
# Download small model (917KB) | |
# Other options: https://fasttext.cc/docs/en/language-identification.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make * work in bash or zsh: | |
# zsh | |
setopt extendedglob | |
# bash | |
shopt -s extglob | |
# Resize all images (in-place) in a folder | |
# to 1200 pixels on the longest side | |
mogrify -resize 1200 *.jpg |
NewerOlder