Skip to content

Instantly share code, notes, and snippets.

View GiuseppeMP's full-sized avatar
:bowtie:
https://giuseppematheus.com/

Giuseppe Matheus GiuseppeMP

:bowtie:
https://giuseppematheus.com/
View GitHub Profile
@GiuseppeMP
GiuseppeMP / SelfExpiringHashMap.java
Created February 8, 2017 11:00
SelfExpiringHashMap - a Java Map which entries expire automatically after a given time; it uses a DelayQueue internally.
import java.util.Collection;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.WeakHashMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.DelayQueue;
import java.util.concurrent.Delayed;
import java.util.concurrent.TimeUnit;
@GiuseppeMP
GiuseppeMP / create-repository-cli.md
Last active November 19, 2019 23:23
Create repository using cli
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin [email protected]:<username>/<reponame>.git
git push -u origin master
@GiuseppeMP
GiuseppeMP / better-nodejs-require-paths.md
Created November 21, 2019 00:16 — forked from branneman/better-nodejs-require-paths.md
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@GiuseppeMP
GiuseppeMP / zshrc
Created January 9, 2020 19:24 — forked from LukeSmithxyz/zshrc
# Luke's config for the Zoomer Shell
# Enable colors and change prompt:
autoload -U colors && colors
PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
# History in cache directory:
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.cache/zsh/history
# auto detects a good number of processes to run
worker_processes auto;
#Provides the configuration file context in which the directives that affect connection processing are specified.
events {
# Sets the maximum number of simultaneous connections that can be opened by a worker process.
worker_connections 8000;
# Tells the worker to accept multiple connections at a time
multi_accept on;
}
@GiuseppeMP
GiuseppeMP / .zshrc
Last active March 8, 2020 22:07
zshrc beppe 03-08-20
export PATH=$HOME/bin:/usr/local/bin:$PATH
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8
export ARCHFLAGS="-arch x86_64"
export ZSH="/Users/giuseppe/.oh-my-zsh"
export JAVA_HOME="/Library/Java/JavaVirtualMachines/adoptopenjdk-8-openj9.jdk/Contents/Home"
@GiuseppeMP
GiuseppeMP / index-0.html
Last active April 16, 2020 22:00
Treinamento-Git-Part-I-Gists
<!DOCTYPE html>
<html lang="en">
<head>
<title>Treinamento de Git Localiza</title>
<meta charset="utf-8" />
</head>
<body>
<h1 style="color: #07F">Parte I - Arquitetura Git, Comandos Básicos</h1>
<p>Começando com básico</p>
<h2 style="color: green">Módulos</h2>

"#" - comentário no .gitignore

adicionar repositório remoto à um local

git remote add origin

ver url de repositorio remoto

git remote -v

FROM adoptopenjdk/openjdk9-openj9:latest
# Change "latest" for "alpine" or to a specific version.
RUN mkdir /opt/shareclasses
RUN mkdir /opt/app
COPY app.jar /opt/app
CMD ["java", "-Xmx128m", "-XX:+IdleTuningGcOnIdle", "-Xtune:virtualized", "-Xscmx128m", "-Xscmaxaot100m", "-Xshareclasses:cacheDir=/opt/shareclasses", "-jar", "/opt/app/app.jar"]