Skip to content

Instantly share code, notes, and snippets.

View ivanmonteiro's full-sized avatar

Ivan Monteiro Cantalice ivanmonteiro

  • Brazil
View GitHub Profile
@ivanmonteiro
ivanmonteiro / ListAdapter.java
Created January 14, 2018 03:41 — forked from elevine/ListAdapter.java
Boilerplate code for creating an Android Adapter which is backed by an in memory List
import java.util.List;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
/**
* Adapter that is backed by an in memory List.
@ivanmonteiro
ivanmonteiro / docker-mysql-v5-7.txt
Created May 5, 2018 13:08
docker mysql with volume and database-user creation
docker run --name=mysql -e MYSQL_ROOT_PASSWORD=mypassword -e MYSQL_DATABASE=mydbname -e MYSQL_USER=mydbusername -e MYSQL_PASSWORD=mydbpassword --mount type=volume,src=crv_mysql,dst=/var/lib/mysql -p 3306:3306 -d mysql/mysql-server:5.7
@ivanmonteiro
ivanmonteiro / metabase-docker-memory-limit-512mb
Last active October 17, 2018 02:37
Run metabase on docker with java_options memory limit of 1gb
docker run -d -p 3000:3000 -e "JAVA_TOOL_OPTIONS=-Xmx1g" -v ~/metabase-data:/metabase-data -e "MB_DB_FILE=/metabase-data/metabase.db" --name metabase metabase/metabase
docker run -d -p 1880:1880 -v ~/node-red-data:/data --name nodered --restart nodered/node-red-docker
docker run -d -p 1883:1883 -p 9001:9001 --name mosquitto --restart=always -v ~/mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf -v ~/mosquitto/data -v ~/mosquitto/log eclipse-mosquitto
@ivanmonteiro
ivanmonteiro / raspberry-pi-3-compile-optimizations.txt
Last active July 15, 2019 18:27
Raspberry Pi 3 Model B - Opencv 3.4.4 compile
#install pre-requisites
sudo apt-get install build-essential checkinstall cmake pkg-config yasm git gfortran libjpeg-dev libjasper-dev libpng-dev libtiff5-dev libtiff-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine2-dev libv4l-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libgtk2.0-dev libtbb-dev qt5-default libatlas-base-dev libmp3lame-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev libopencore-amrnb-dev libopencore-amrwb-dev libavresample-dev x264 v4l-utils libprotobuf-dev protobuf-compiler libgoogle-glog-dev libgflags-dev libgphoto2-dev libeigen3-dev libhdf5-dev doxygen
#add symlink for libv4l
sudo ln -s -f /usr/include/libv4l1-videodev.h /usr/include/linux/videodev.h
#download and install Intel TBB precompiled for raspberry pi 2/3 b
git clone https://github.com/abhiTronix/TBB_Raspberry_pi.git
cd TBB_Raspberry_pi/
sudo dpkg -i libtbb-dev_4.5-1_armhf.deb
#Script to install Opencv 3.4.4 with optmizations for raspberry pi that can increase performance up to 50%!
#install pre-requisites
sudo apt-get install build-essential checkinstall cmake pkg-config yasm git gfortran libjpeg-dev libjasper-dev libpng-dev libtiff5-dev libtiff-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine2-dev libv4l-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libgtk2.0-dev libtbb-dev qt5-default libatlas-base-dev libmp3lame-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev libopencore-amrnb-dev libopencore-amrwb-dev libavresample-dev x264 v4l-utils libprotobuf-dev protobuf-compiler libgoogle-glog-dev libgflags-dev libgphoto2-dev libeigen3-dev libhdf5-dev doxygen
#add symlink for libv4l
sudo ln -s -f /usr/include/libv4l1-videodev.h /usr/include/linux/videodev.h
#download and install Intel TBB precompiled for raspberry pi 2/3 b
git clone https://github.com/abhiTronix/TBB_Raspberry_pi.git
cd TBB_Raspberry_pi/
@ivanmonteiro
ivanmonteiro / mysql-5.7-docker.sh
Last active October 9, 2019 23:29
Mysql 5.7 docker with data volume, restart unless stopeed and custom config
docker run --name mysql --env-file /home/ubuntu/mysql-env/.env -v /home/ubuntu/mysql-data:/var/lib/mysql -v /home/ubuntu/mysql-config/my.cnf:/etc/my.cnf -p 3306:3306 -d --restart unless-stopped mysql:5.7
@ivanmonteiro
ivanmonteiro / settings.json
Created August 5, 2020 05:43
My Windows Terminal Settings
// This file was initially generated by Windows Terminal 0.11.1251.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
@ivanmonteiro
ivanmonteiro / nginx.conf
Created October 10, 2020 00:52
Best practice secure NGINX configuration for WordPress
# From blog post https://www.getpagespeed.com/server-setup/nginx/best-practice-secure-nginx-configuration-for-wordpress
server {
server_name example.com;
root /srv/www/example.com/public;
security_headers on;