Skip to content

Instantly share code, notes, and snippets.

View dumpstate's full-sized avatar

Albert Sadowski dumpstate

  • Globality, Inc.
  • London, United Kingdom
View GitHub Profile
@dumpstate
dumpstate / no_ssl_verification.py
Created June 15, 2023 11:22
Context manager disabling SSL verification for requests python library.
import contextlib
import warnings
import requests
old_merge_environment_settings = requests.Session.merge_environment_settings
@contextlib.contextmanager
@dumpstate
dumpstate / retry
Last active February 27, 2023 10:58
Re-try (flaky) command until it's successful. #script
#!/usr/bin/env bash
# Re-try command until successful.
#
# Usage:
# retry flaky command
set -euo pipefail
until $@; do echo "Re-trying..."; done
@dumpstate
dumpstate / sdoc2txt.sh
Created December 6, 2020 22:05
Extract text from Samsung Notes file
#!/bin/sh
set -e
SDOC=$1
TMP_ROOT="/tmp"
if ! [ -f ${SDOC} ]; then

Keybase proof

I hereby claim:

  • I am dumpstate on github.
  • I am albertsadowski (https://keybase.io/albertsadowski) on keybase.
  • I have a public key whose fingerprint is E0DD ACE6 A941 C590 F437 C47D 747D D73D F2A3 5EB4

To claim this, I am signing this object:

the martian in san francisco tomorrow
[MOVIE_NAME: the martian] [PREPOSITION: in] [THEATER_LOCATION: san francisco] [TIME_EXPRESSION: tomorrow] (in 8 ms)
the revenant in amc next week
[MOVIE_NAME: the revenant] [PREPOSITION: in] [THEATER_NAME: amc] [TIME_EXPRESSION: next week] (in 15 ms)
cinemark next wednesday
[THEATER_NAME: cinemark] [TIME_EXPRESSION: next wednesday] (in 2 ms)
drama in san francisco on 11 june
val taggedSequence: Segmentation[String, String] =
crf.bestSequence(epic.preprocess.tokenize(inputString))
val crf = SemiCRF
.buildSimple(seq)
.asInstanceOf[SemiCRF[String, String]]
def segmentation(ex: Example[IndexedSeq[String], IndexedSeq[IndexedSeq[String]]): Segmentation[Any, String] = {
val segments = ex.label.foldLeft(List.empty[(String, Int, Int)] {
case (acc, label) => acc match {
case head :: tail => head match {
case (`label`, beg, end) => (label, beg, end + 1) :: tail
case (nextLabel, beg, end) => (label, end, end + 1) :: head :: tail
}
case Nil => List((String, 0, 1))
}
val seq = sequenceReader.map(segmentation)
var sequenceReader = CONLLSequenceReader
.readTrain(dataSetInputStream)
.toIndexedSeq