Skip to content

Instantly share code, notes, and snippets.

View aferreira44's full-sized avatar
馃幆
Solving problems

Andr茅 Ferreira aferreira44

馃幆
Solving problems
View GitHub Profile
@aferreira44
aferreira44 / turtle-events.py
Created July 26, 2019 01:04
Event-driven programming with Turtle module
import turtle
t = turtle.Turtle()
ts = t.getscreen()
t.shape("turtle")
t.color("yellow")
ts.bgcolor("black")
go = False
@aferreira44
aferreira44 / mysql_commands.sql
Created April 20, 2019 17:10
MySQL commands
show databases;
create database my_db;
use my_db;
show tables;
grant all privileges on my_db.* to 'username'@'localhost' IDENTIFIED BY 'password';
@aferreira44
aferreira44 / tmux.md
Created September 25, 2018 17:34 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@aferreira44
aferreira44 / rocket-chat-install.sh
Last active August 1, 2018 05:04
Shell script to install RocketChat
# Install upstart
sudo apt install -y upstart-sysv
# Configure Nginx web server with TLS/SSL
sudo apt-get install -y nginx
cd /etc/nginx/sites-available
sudo cp default default.reference
sudo bash -c 'echo -e "#server {\n#listen 443 ssl;\n#server_name <ABC.DOMAIN.COM>;\n#ssl_certificate /etc/letsencrypt/live/<ABC.DOMAIN.COM>/fullchain.pem;\n#ssl_certificate_key /etc/letsencrypt/live/<ABC.DOMAIN.COM>/privkey.pem;\n#ssl_protocols TLSv1 TLSv1.1 TLSv1.2;\n#ssl_prefer_server_ciphers on;\n#ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';\n#root /usr/share/nginx/html;\n#index index.html index.htm;\n## Make site accessible from http://localhost/\n#server_name localhost;\n#location / {\n# proxy_pass http://localhost:3000/;\n# proxy_http_version 1.1;\n# proxy_set_header Upgrade $http_upgrade;\n# proxy_set_header Connection "upgrade";\n# proxy_set_header Host $http_host;\n# proxy_set_header X-Real-IP $remote_addr;\n# proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;\n# pro
@aferreira44
aferreira44 / install-postgresql.sh
Created February 12, 2018 00:05
Install PostgreSQL and create a superuser role and a database
#!/bin/bash
# Install PostgreSQL
sudo apt-get install postgresql
# Create a superuser role and a database for your personal user account
sudo -u postgres createuser -s $(whoami); createdb $(whoami)
@aferreira44
aferreira44 / fix-permission.sh
Created February 10, 2018 01:32
Arduino IDE error: ser_open(): can't open device "/dev/ttyUSB0": Permission denied
#!/bin/bash
sudo usermod -a -G dialout andre
sudo chmod a+rw /dev/ttyUSB0
@aferreira44
aferreira44 / running-appImage.sh
Created February 8, 2018 12:28
Making an appImage executable and running it
#!/bin/sh
# Making it executable
chmod a+x exampleName.AppImage
# Executing it
./exampleName.AppImage
@aferreira44
aferreira44 / creating-swap-file.sh
Last active February 8, 2018 18:21
Creating and modifying swap on an existing machine
#!/bin/sh
# https://wiki.debian.org/Swap
# PATH is the exact path to the directory you wish to place your swap file,
# FILENAME is the name you wish to give your swapfile
# SIZE is the size you wish your swap file to be in kilobytes (for example 1048576 is 1 gigabyte).
# The chmod command is to make sure the file is not world readable for security reasons.
dd if=/dev/zero of=/PATH/FILENAME bs=1024 count=SIZE
@aferreira44
aferreira44 / improve-font-rendering.sh
Created February 7, 2018 13:33
Debian Gnome Desktop - Improve Font Rendering
#!/bin/sh
# http://blog.programster.org/debian-8-gnome-desktop-improve-font-rendering
mkdir -p $HOME/.config/fontconfig/
echo "<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<match target="font">
<edit mode="assign" name="rgba">
@aferreira44
aferreira44 / keyboard-configuration.sh
Created February 7, 2018 03:33
Configure keyboard layout
#!/bin/sh
sudo dpkg-reconfigure keyboard-configuration