Skip to content

Instantly share code, notes, and snippets.

View allanfreitas's full-sized avatar
🏠
Working from home

Allan Freitas allanfreitas

🏠
Working from home
View GitHub Profile
@allanfreitas
allanfreitas / docker-compose.yml
Created May 9, 2020 13:23 — forked from tsh-code/docker-compose.yml
Starting docker compose for our system
version: '3.3'
services:
security-db:
image: postgres
environment:
POSTGRES_DB: security
POSTGRES_USER: security
POSTGRES_PASSWORD: password
reporting-db:
version: "3.7"
services:
elasticsearch:
image: elasticsearch:7.6.0
ports:
- "9200:9200"
- "9300:9300"
environment:
discovery.type: single-node
@allanfreitas
allanfreitas / README.md
Created September 9, 2019 18:02 — forked from celisflen-bers/README.md
Python script to convert DBF database file to CSV
@allanfreitas
allanfreitas / HibernateDDLFlywayMigration.java
Created September 9, 2019 12:56 — forked from mattbroekhuis/HibernateDDLFlywayMigration.java
Export hibernate ddl changes to flyway db migrations in spring mvc or spring boot
@Slf4j
@Component
@Profile("exportDDL")
@org.springframework.context.annotation.Configuration
class HibernateDDLFlywayMigration {
@Bean ExportDDLExecutor exportDDLExecutor(Environment environment, Flyway flyway, EntityManagerFactory factory){
return new ExportDDLExecutor(environment, flyway, factory)
}
@allanfreitas
allanfreitas / bash_interactive_and_login.sh
Created May 24, 2019 01:41 — forked from CMCDragonkai/bash_interactive_and_login.sh
Bash & ZSH: Interactive and Login Shells
#!/usr/bin/env bash
[[ $- == *i* ]] && echo "This Bash Shell is Interactive Shell" || echo "This Bash Shell is Not a Interactive Shell"
shopt -q login_shell && echo "This Bash Shell is a Login Shell" || echo "This Bash Shell is Not a Login Shell"
@allanfreitas
allanfreitas / setup.md
Created November 3, 2018 17:30 — forked from kpheasey/setup.md
WSL, RVM & RubyMine; ubuntu on windows, bash on windows

Add inbound firewall rule for TCP 2222

  • Windows 10 has 2 new services, SSH Server Proxy and SSH Server Broker which will already be bound to port 22
  • Do not allow public connection on this rule, WSL is not proven safe

ConEmu

Add as cmd startup with bash.exe --login

Install the SSH server and some Rails essentials libraries in bash

sudo apt-get update && sudo apt-get upgrade -y
@allanfreitas
allanfreitas / CodeFromCommentOnOriginalGist.py
Created August 7, 2018 07:08 — forked from Jaza/Flask-blueprint-with-imported-routes
Example of how to split a Flask blueprint into multiple files, with routes in each file, and of how to register all those routes.
Very helpfull example. I exemined your way of solving problem and came up to this solution:
"""
Application router decoretor.
Use this to append or get rout list for specific modules.
"""
from functools import wraps
@allanfreitas
allanfreitas / sample_ssh_server.py
Created August 2, 2018 10:07 — forked from cschwede/sample_ssh_server.py
Sample paramiko SSH server to receive commands
#!/usr/bin/env python
import logging
import socket
import sys
import threading
import paramiko
logging.basicConfig()
logger = logging.getLogger()
@allanfreitas
allanfreitas / Dockerfile
Created July 11, 2018 00:01 — forked from PurpleBooth/Dockerfile
Create a static binary in go and put it in a from scratch docker container
FROM golang:1.9
RUN mkdir -p /go/src/github.com/purplebooth/example
WORKDIR /go/src/github.com/purplebooth/example
COPY . .
RUN go build -ldflags "-linkmode external -extldflags -static" -a main.go
FROM scratch
COPY --from=0 /go/src/github.com/purplebooth/example/main /main
CMD ["/main"]
@allanfreitas
allanfreitas / generate-ssh-key.sh
Created June 11, 2018 18:18 — forked from grenade/01-generate-ed25519-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "rthijssen@gmail.com" -f ~/.ssh/mozilla_rsa