Skip to content

Instantly share code, notes, and snippets.

View linuxd3v's full-sized avatar

James Carter linuxd3v

View GitHub Profile
@linuxd3v
linuxd3v / Dockerfile
Created March 9, 2024 00:38
sequitur-g2p
FROM ubuntu:20.04
RUN apt-get -yqq update && apt-get install -yqq g++ libopenblas-dev libopenblas-base swig git python-dev python3-pip python3-venv libblas-dev liblapack-dev libatlas-base-dev gfortran
RUN mkdir /app
WORKDIR /app
RUN python3 -m venv .venv && . .venv/bin/activate
RUN pip3 install numpy==1.17.4 six==1.11.0
RUN pip3 install git+https://github.com/sequitur-g2p/sequitur-g2p@master
CMD ["g2p.py"]
<script>
;(function(win, doc, style, timeout) {
var STYLE_ID = 'at-body-style';
function getParent() {
return doc.getElementsByTagName('head')[0];
}
function addStyle(parent, id, def) {
if (!parent) {
return;
}
@linuxd3v
linuxd3v / php-return-redis-handle-into-redis-pool.php
Created May 15, 2023 14:42
PHP Swoole - properly returning the pooled redis handle into the pool in a "finally" block
protected function removeSomeListItemBlahBlah(string $name, string $key)
{
try {
$cacheHandle = $this->pool->borrow();
$result = $cacheHandle->lrem($name, $key, 0);
} catch (Throwable $e) {
// Log the error
$this->logger->error('Exception while trying to removeSomeListItemBlahBlah', ['exception' => $e]);
# Static Brotli:
# Browser accepts brotli, and matching pre-compressed file exists => rewrite to .br file
# For each file format set the correct mime type (otherwise brotli mime type is returned) and prevent Nginx for recompressing the files
set $extension "";
if ($http_accept_encoding ~ br) {
set $extension .br;
}
if (-f $request_filename$extension) {
rewrite (.*) $1$extension break;