Skip to content

Instantly share code, notes, and snippets.

@nivb52
nivb52 / generate_confd.sh
Last active August 15, 2024 09:57
Working with Confd 2
confd --version
find -name "confd" -type d |
while IFS= read -r dir; do
echo "$dir";
export SERVICE_NAME=`echo "$dir" | cut -d "/" -f 2 `
mkdir -p "$dir"/conf.d;
mkdir -p "$dir"/templates;
cp "$dir"/*.tmpl "$dir"/templates;
cp "$dir"/*.toml "$dir"/conf.d;
@nivb52
nivb52 / auto-translation.txt
Created June 27, 2023 19:48
auto translation api
i18n-auto-translation -t "he" -p {full_path}\i18n\en.json --apiProvider "deep-rapid" -k {key}
@nivb52
nivb52 / git-commands.md
Last active June 22, 2022 13:26
git-commands

CLEAN BRANCHES

in the git config: git config --global alias.clean-branches "!git branch | grep -v master | xargs git branch -D" or by edit the config file : [alias] # remove all but the mention git trim = !git branch | grep -v -E 'master|main|development|integration|production' | xargs git branch -D

How can I delete all Git branches which have been merged?

@nivb52
nivb52 / restart_nginx.bat
Last active April 28, 2022 19:51
restart nginx
@ECHO OFF
cd c:/development/nginx-1.8.1/
taskkill /f /IM nginx.exe
start nginx.exe
EXIT
@nivb52
nivb52 / sqlQueryBuilderFunction.js
Created January 11, 2022 20:09
SQL/Posgress Query Builder Function
/**
* @param jsonPath {String}
* @example 'name.people.joe' returns 'name ->> people ->> joe'
* @returns {String}
*/
function createSearchJsonQuery (jsonPath) {
const add = jsonPath.split('.').join(' -> ');
return (add.substring(0, add.lastIndexOf('->')) + ' ->> ' + add.substring(add.lastIndexOf('->') +3 ));
}
@nivb52
nivb52 / sql_small_utils_and_functions.sql
Created December 8, 2021 08:26
Small Clauses and Functions For PosgresSql
-- Random Text
(SELECT array_to_string(array(select substr('ABCDEFGHIJKLMNOPQRSTUVWX-Y-Z_0123456789',((RANDOM()*(39)+1)::integer),1) from generate_series(1,16)),''))
@nivb52
nivb52 / package.json
Created November 8, 2021 23:04 — forked from kentcdodds/package.json
setup script for my workshops
{
"name": "workshop-setup",
"version": "1.0.0",
"description": "This is the common setup script for most of my workshops",
"bin": "./setup.js"
}
@nivb52
nivb52 / package.json
Created November 8, 2021 23:04 — forked from kentcdodds/package.json
Validates that the versions of tools specified in `engines` in the package.json are installed on the machine.
{
"name": "workshop-computer-validator",
"version": "1.0.0",
"description": "I use this to validate people's computers have the proper versions of node and npm installed for a workshop",
"bin": "./validate-system.js",
"dependencies": {
"semver": "7.1.3"
}
}
@nivb52
nivb52 / git_commands .txt
Last active November 25, 2021 13:20
Git
## INIT
echo "# starting new great project" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/nivb52/--repo--name--.git
git push -u origin main
@nivb52
nivb52 / extractUniqueValuesFromCollection.js
Created August 3, 2021 10:53
extract Unique Values From Collection by property using sets and funtion or instruction per property
/**
* @param collection {[]}
* @param properties {String[]}
* @param options {{return_as_arrays: (Boolean), : {extract_instruction: (String), extract_function: (Function)}}}
* @example:
* transport_items_data,
* ['transport_item_type_id', 'status_ids_for_filtering', 'status_ids'],
* {return_as_arrays: true, status_ids_for_filtering: {extract_instruction: 'spread'}, status_ids: {extract_instruction: 'spread'}}
* @returns {Object}
*/