Skip to content

Instantly share code, notes, and snippets.

View W3SS's full-sized avatar
🎯
Focusing

Wendel G. Santana W3SS

🎯
Focusing
View GitHub Profile
server {
listen 80;
index index.php index.html;
server_name _;
root /var/www/html/public;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
version: "3"
networks:
laravel:
services:
nginx:
build:
context: ./dockerfiles
dockerfile: nginx.dockerfile
args:
FROM nginx:stable-alpine
ARG UID
ARG GID
ENV UID=${UID}
ENV GID=${GID}
RUN delgroup dialout
@W3SS
W3SS / Dockerfile
Created September 22, 2022 23:48 — forked from arctic-hen7/Dockerfile
Starter Dockerfile with ZSH (Alpine)
# Setup Stage - set up the ZSH environment for optimal developer experience
FROM alpine:latest AS setup
# Let scripts know we're running in Docker (useful for containerised development)
ENV RUNNING_IN_DOCKER true
# Use the unprivileged `main` user (created without a password ith `-D`) for safety
RUN adduser -D main
RUN mkdir -p /app \
&& chown -R main:main /app
# Set up ZSH and our preferred terminal environment for containers
RUN apk --no-cache add zsh curl git
@W3SS
W3SS / Install_php_mysql_phpmyadmin_ubuntu_18_04.md
Created July 17, 2022 04:26 — forked from arsho/Install_php_mysql_phpmyadmin_ubuntu_18_04.md
Install basic tools in Ubuntu 22.04 LTS. It includes: oh-my-zsh, idle, venv, git, tree, MySQL, PHP, phpMyAdmin.

Install PHP, MySQL, phpMyAdmin in Ubuntu 18.04 LTS

Install Mysql Server and MySQL Client

What is the difference between MySQL Server and MySQL Client?

MySql Client: The mysql-client package allows you to connect to a MySQL server. It will give you the mysql command-line program.

MySql Server: The mysql-server package allows to run a MySQL server which can host multiple databases and process queries on those databases.

  • Update Ubuntu
That’s one of the real strengths of Docker: the ability to go back to a previous commit. The secret is simply to docker tag the image you want.
Here’s an example. In this example, I first installed ping, then committed, then installed curl, and committed that. Then I rolled back the image to contain only ping:
$ docker history imagename
IMAGE CREATED CREATED BY SIZE
f770fc671f11 12 seconds ago apt-get install -y curl 21.3 MB
28445c70c2b3 39 seconds ago apt-get install ping 11.57 MB
8dbd9e392a96 7 months ago 131.5 MB
@W3SS
W3SS / TestNativeQueryToListJson.java
Created May 18, 2021 16:59 — forked from baxtheman/TestNativeQueryToListJson.java
Java JPA Native Query using Tuple and return List of Jackson JSON Object
/*
Needs Hibernate 5.2.11.Final
*/
public List<ObjectNode> getQuery(
Integer anno,
Integer settimana) {
Query q = em.createNativeQuery(
"NATIVE SQL....",Tuple.class);
@W3SS
W3SS / filterArray.js
Created February 11, 2021 20:42 — forked from jherax/arrayFilterFactory.1.ts
Filters an array of objects with multiple match-criteria.
/**
* Filters an array of objects using custom predicates.
*
* @param {Array} array: the array to filter
* @param {Object} filters: an object with the filter criteria
* @return {Array}
*/
function filterArray(array, filters) {
const filterKeys = Object.keys(filters);
return array.filter(item => {
@W3SS
W3SS / multiFilter.js
Created February 11, 2021 20:42 — forked from diegochavez/multiFilter.js
Multi filters an array of objects
/**
* Multi-filter an array of objects
* @param {Array} array : list of elements to apply a multiple criteria filter
* @param {Object} filters: Contains multiple criteria filters by the property names of the objects to filter
* @return {Array}
*/
function multiFilter(array, filters) {
let filterKeys = Object.keys(filters);
// filters all elements passing the criteria
return array.filter((item) => filterKeys.every((key) => (filters[key].indexOf(item[key]) !== -1)));