Skip to content

Instantly share code, notes, and snippets.

View jerinphilip's full-sized avatar
🏡

Jerin Philip jerinphilip

🏡
View GitHub Profile

Keybase proof

I hereby claim:

  • I am jerinphilip on github.
  • I am jerinphilip (https://keybase.io/jerinphilip) on keybase.
  • I have a public key whose fingerprint is 8BF7 54E8 C7A5 041C F22B 7351 D3EF BE43 1002 328C

To claim this, I am signing this object:

@jerinphilip
jerinphilip / android-build.sh
Created March 11, 2022 13:44
Temporary save of something to run android-build
#!/bin/bash
NDK=/mnt/Storage/jphilip/android-ndk-r23b
ABI=arm64-v8a
MINSDK_VERSION=28
CUSTOM_MODULE_PATH=/mnt/Storage/jphilip/marian-android/openblas-install/lib/cmake/openblas
ANDROID_PLATFORM=28
OTHER_ANDROID_ARGS=(
-DANDROID_ARM_NEON=TRUE
@jerinphilip
jerinphilip / generate.py
Last active January 31, 2022 11:42
Mozilla Models
import requests
import re
from slimit.parser import Parser
from slimit import ast
import json
from argparse import ArgumentParser
def recurse(node):
if isinstance(node, ast.String):
return node.value.replace('"', '')
@jerinphilip
jerinphilip / naive-unk-replacement.py
Last active June 25, 2021 17:39
Emoji (oov) replacement from source
def replace_unk_from_source(service):
def __replace_unk_from_source(source):
opts = ResponseOptions()
opts.alignment = True
opts.alignmentThreshold = 1.0 # hardAlignment
response = service.translate(source, opts)
target = response.target.text
replace_ops = []
for sentenceIdx, alignment in enumerate(response.alignments):
@jerinphilip
jerinphilip / pcrecpp.patch
Last active February 19, 2021 17:53
PCRECPP.patch
diff --git a/src/translator/sentence_splitter.cpp b/src/translator/sentence_splitter.cpp
index 0370125..9011a69 100644
--- a/src/translator/sentence_splitter.cpp
+++ b/src/translator/sentence_splitter.cpp
@@ -4,6 +4,8 @@
#include "common/options.h"
#include <string>
+#include <pcrecpp.h>
+
@jerinphilip
jerinphilip / Makefile
Last active March 24, 2021 18:58
Some bergamot-makefile
# This Makefile is being prepared to cache installation setups on
# jenkins@vali.inf.ed.ac.uk and ensure that WASM pipeline builds and route
# through regression tests.
THREADS=40
SHELL := /bin/bash
ROOT := /mnt/Storage/jphilip/bergamot
@jerinphilip
jerinphilip / sample-sbatch-script.sh
Created June 6, 2020 07:35
Sample Sbatch Script
#!/bin/bash
#SBATCH --partition long
#SBATCH --account jerin
#SBATCH --nodes 1
#SBATCH --ntasks 1
#SBATCH --gres gpu:4
#SBATCH --cpus-per-task 40
#SBATCH --mem-per-cpu 2G
#SBATCH --time UNLIMITED
#SBATCH --signal=B:HUP@900
@jerinphilip
jerinphilip / available-nodes.py
Created May 13, 2020 09:16
Command to detect non-blocked nodes in SLURM (which ones have free CPU, GPU, Mem to gain alloc)
import subprocess as sp
from collections import defaultdict
from pprint import pprint
import humanfriendly
def run(cmd):
p = sp.check_output(cmd, shell=True)
return p.decode("utf-8")
@jerinphilip
jerinphilip / Makefile
Created May 10, 2020 21:34
LatexMk Makefile
LATEX=xelatex
LATEXOPT=--shell-escape
NONSTOP=--interaction=nonstopmode
LATEXMK=latexmk
LATEXMKOPT=-pdf
CONTINUOUS=-pvc
MAIN=main
JOBNAME='-jobname=build/$(MAIN)'
@jerinphilip
jerinphilip / latexmkrc
Created May 1, 2020 09:01
Overleaf's latexmkrc
###############################
# Post processing of pdf file #
###############################
# assume the jobname is 'output' for Overleaf v2
my $ORIG_PDF_AGE = -M "output.pdf"; # get age of existing pdf if present
END {
my $NEW_PDF_AGE = -M "output.pdf";
return if !defined($NEW_PDF_AGE); # bail out if no pdf file