Skip to content

Instantly share code, notes, and snippets.

# condition typying
export type ValueType<OptionType extends OptionTypeBase, IsMulti extends boolean> = IsMulti extends true
? OptionsType<OptionType>
: OptionType | null;
@etudor
etudor / gist:7a10ab6447f3466b5de5ee78e0b67f0d
Created January 18, 2021 22:42
Configure non-root user in Dockerfile
# Configure non-root user.
ARG PUID=1000
ENV PUID ${PUID}
ARG PGID=1000
ENV PGID ${PGID}
RUN groupmod -o -g ${PGID} www-data && \
usermod -o -u ${PUID} -g www-data www-data
USER 1000:1000
@etudor
etudor / nifi.md
Last active October 3, 2018 14:09
Apache Nifi Resources

Setup sql connection:

dockerfile config

RUN wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java_8.0.12-1debian9_all.deb
RUN dpkg -i mysql-connector-java_8.0.12-1debian9_all.deb

Default database driver location:

@etudor
etudor / gist:e2791d8633459b0d6fe67cff2566d133
Created August 20, 2018 09:37
Programatically create a new object/array in elasticsearch with painless
// painless language
// create a new object
ctx._source.ml = = new HashMap();
// create a new array
ctx._source.products = new ArrayList();
// check if a key exists on an object
if (ctx._source.ml.get('label') == null) {
@etudor
etudor / OVH Openstack Object Storage Upload File
Created November 23, 2017 21:46
upload a file to ovh openstack object storage via PHP
// install package: rackspace/php-opencloud
$client = new OpenCloud\OpenStack('https://auth.cloud.ovh.net/v2.0', [
'username' => self::OVH_OPENSTACK_USERNAME,
'password' => self::OVH_OPENSTACK_PASSWORD,
'tenantId' => self::OVH_OPENSTACK_PROJECT_ID,
]);
// 2. Obtain an Object Store service object from the client.
$objectStoreService = $client->objectStoreService('swift', 'DE1');
@etudor
etudor / gist:dc0ab4f9f53c1b50714a78fb8703e0c8
Last active May 10, 2017 10:33
NeoVim Config File Windows Location
Neovim configuration path:
~/AppData/Local/nvim/init.vim
Neovim plugin manager:
https://github.com/junegunn/vim-plug
/**
* @SWG\Property(
* type="array",
* @SWG\Items(ref="#/definitions/ProductSiren")
* )
* @JMS\Type()
* @var ProductSiren[]
*/
protected $entities;
bin/behat --suite=suiteName
@etudor
etudor / .vimrc
Last active December 24, 2015 22:26
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
"let Vundle manage Vundle, required
@etudor
etudor / Remove Diacritics
Last active August 29, 2015 14:18
remove diactritics from string
function normalizeChars($s) {
$replace = array(
'ъ'=>'-', 'Ь'=>'-', 'Ъ'=>'-', 'ь'=>'-',
'Ă'=>'A', 'Ą'=>'A', 'À'=>'A', 'Ã'=>'A', 'Á'=>'A', 'Æ'=>'A', 'Â'=>'A', 'Å'=>'A', 'Ä'=>'Ae',
'Þ'=>'B',
'Ć'=>'C', 'ץ'=>'C', 'Ç'=>'C',
'È'=>'E', 'Ę'=>'E', 'É'=>'E', 'Ë'=>'E', 'Ê'=>'E',
'Ğ'=>'G',
'İ'=>'I', 'Ï'=>'I', 'Î'=>'I', 'Í'=>'I', 'Ì'=>'I',
'Ł'=>'L',