Skip to content

Instantly share code, notes, and snippets.

View Gabri's full-sized avatar
💭
Stay human

Gabri Gabri

💭
Stay human
View GitHub Profile
@Gabri
Gabri / gcp cloud sql proxy.md
Last active February 2, 2022 14:29
Google Cloud Plathform - course
@Gabri
Gabri / git.sh
Created February 26, 2021 16:46
[Git] git snippets #git
# pushing a new local branch ot a specific origin
git push -u origin-menarini HEAD
@Gabri
Gabri / rsync.sh
Created December 27, 2020 16:35
[rsync] rsync commands #rsync #sync
# Testing rsync with dry-run
rsync --dry-run -vrhm --include='Bottino*/*' --include='*/' --exclude='*' ~/shared/jesse/strategies/ ~/ws/git/cry/jesse-py-strat
rsync --dry-run -vrhm --include='Trend*/*' --include='*/' --exclude='*' ~/shared/jesse/strategies/ ~/ws/git/cry/jesse-py-strat
rsync --dry-run -vrhm --include='Time*/*' --include='*/' --exclude='*' ~/shared/jesse/strategies/ ~/ws/git/cry/jesse-py-strat
# NO dry-run
rsync -vrhm --include='*/' ~/shared/jesse/custom_indicators/ ~/ws/git/cry/jesse-py-strat/custom_indicators
rsync -vrhm --include='Bottino*/*' --include='*/' --exclude='*' ~/shared/jesse/strategies/ ~/ws/git/cry/jesse-py-strat
rsync -vrhm --include='Time*/*' --include='*/' --exclude='*' ~/shared/jesse/strategies/ ~/ws/git/cry/jesse-py-strat
rsync -vrhm --include='Trend*/*' --include='*/' --exclude='*' ~/shared/jesse/strategies/ ~/ws/git/cry/jesse-py-strat
@Gabri
Gabri / snippets_arch.sh
Last active June 9, 2021 08:46
[Linux] arch linux snippets #linux #arch
# How to list all auto-start services in archlinux?
systemctl list-unit-files | grep enabled && systemctl --user list-unit-files | grep enabled
# How to find out mount/partition a directory or file is on?
df -P file/goes/here | tail -1 | cut -d' ' -f 1
# add GPG key (ERROR: One or more PGP signatures could not be verified!)
gpg --recv-key gpg --recv-key D1742AD60D811D58
@Gabri
Gabri / testtab.js
Created November 13, 2020 08:36
[Postman] snippet per settare una variabile da response (authentication) #auth #postman
var jsonData = JSON.parse(responseBody);
if (jsonData.ticket) {
postman.setEnvironmentVariable("alf_ticket", jsonData.ticket);
}
@Gabri
Gabri / impost.sql
Created November 11, 2020 23:43
[MySQL] MySql snippets #mysql #sql
-- importing (large) file on db
mysql -h 127.0.0.1 -u gabri_deiverbum -p gabri_deiverbum < gabri_deiverbum-20201107.sql
@Gabri
Gabri / replacer.sh
Last active November 28, 2020 08:48
[Sed] substitutions replace #replace #substitution #sed
# sostituisco alcuni caratteri non correttamente visualizzati leggendo dal primo file e genrandone uno nuovo di output
sed -e 's/è/è/g' -e 's/“/\"/g' -e 's/â€<9d>/\"/g' -e 's/ì/ì/g' -e 's/°/°/g' -e 's/ò/ò/g' testcharset.txt > testcharset_utf8.txt
# directly replace on file
sed -i -e 's/è/è/g' -e 's/“/\"/g' -e 's/”/\"/g' -e 's/’/\'/g' -e 's/â€<9d>/\"/g' -e 's/ì/ì/g' -e 's/°/°/g' -e 's/ò/ò/g' -e 's/È/E\'/g' -e 's/à/à/g' -e 's/–/-/g' gabri_nueter-20201107.sql
# for SQL import with escaping
sed -e 's/è/è/g' -e 's/é/è/g' -e 's/â€/\"/g' -e 's/“/\"/g' -e 's/’/\\\\\'/g' -e 's/Õ/\\\\\'/g' -e 's/â€<9d>/\"/g' -e 's/ì/ì/g' -e 's/°/°/g' -e 's/ò/ò/g' -e 's/È/É/g' -e 's/á/à/g' -e 's/à/à/g' -e 's/à /à/g' -e 's/ù/ù/g' -e 's/–/-/g' gabri_nueter-20201107.sql > gabri_nueter-20201107_UPD.sql
@Gabri
Gabri / snippets.md
Created October 23, 2020 13:09
[Oracle] oracle snippts #oracle #sql

Oracle commands

Tablespaces

CREATE TABLESPACE tbs_mdist2
   DATAFILE 'tbs_mdist2.dbf' 
   SIZE 100m;

CREATE TEMPORARY TABLESPACE tbs_mdist_tmp2
@Gabri
Gabri / angulardev.md
Last active June 18, 2021 16:16
[Angular & Friends] #angular #node #rxjs #ngrx

Angular & Friends

Start local FE (connected to local be)

ng serve --configuration=local-dev

Angular Heroes Tutorial

https://angular.io/tutorial

@Gabri
Gabri / test.java.md
Last active December 14, 2020 11:27
[JUnit Mockito hamcrest] check unit test vari #mockito #java #junit # hamcrest

JUnit Tests (hamcrest)

Settare un valore in un parametro passato in un mock

Settare il valore ID dell'entità passata come parametro chiamando una dao.insert

doAnswer(invocation -> {
	Object[] args = invocation.getArguments();
	((Masterbook) args[0]).setId(1L);
	return 1L;
}).when(masterbookDAO).insert(any(), any());