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 / 0_reuse_code.js
Last active September 19, 2015 20:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Gabri
Gabri / dockerCommands.md
Last active April 6, 2023 03:28
[Docker] docker commands #docker

Docker

Command utility tools

ctop lazydocker

Rimuovere immagini non più usate

docker image prune -f

Pulizia di dati non più utilizzati (images, container, networks)

docker system prune --all --force

@Gabri
Gabri / docker-compose-nginx-php-alpine.yml
Last active November 11, 2020 08:22
[docker compose mysql + phpmyadmin] port phpmyadmin 8306 root/secret #docker
version: '3.7'
# Services
services:
# Nginx Service
web:
container_name: ${PROJECT_NAME}_webngx_${VERSION_ID}
image: nginx:1.17-alpine
ports:
@Gabri
Gabri / README.md
Last active October 23, 2020 22:40
[VPS Lemp setup] every step to run docker lemp #docker #lemp

In order to give our non-root user access to the Docker management commands, we need to create a docker group (it may already be created for you), and then add your primary user to that group.

$ sudo groupadd docker
$ sudo usermod -aG docker $USER

By running this command, we ask Docker Compose to execute Bash on the PHP container:

docker-compose exec php bash
@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());
@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 / 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 / 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 / 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 / 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);
}