Skip to content

Instantly share code, notes, and snippets.

View mdamaceno's full-sized avatar
🇧🇷

Marco Damaceno mdamaceno

🇧🇷
View GitHub Profile

Criar novo usuário do sistema

Somos tentados a usar sempre o usuário root porque não pede senha para rodar comandos. Apesar disso ser uma facilidade, esconde uma vulnerabilidade que pode ser encontrada quando for tarde demais. Usar o sistema como usuário root o tempo todo abre margens para ataques contra o seu servidor. Segurança nunca é demais e para se previnir disso, uma das coisas a se fazer é criar um novo usuário com ou sem permissões de root.

Para criar um novo usuário, digite no terminal:

adduser nomedousuario

Instalar Nginx

sudo apt-get update
sudo apt-get install nginx

Ver se Nginx está funcionando corretamente

Digite no navegador:

@mdamaceno
mdamaceno / ruby-observer.rb
Last active September 30, 2015 00:44
Observer Pattern in Ruby
require "observer"
class Ticker ### Periodically fetch a stock price.
include Observable
def initialize(symbol)
@symbol = symbol
end
def run
@mdamaceno
mdamaceno / 660-init-deb.sh
Created September 4, 2015 12:09 — forked from rschmitty/660-init-deb.sh
Linode script to register nginx after passenger install http://library.linode.com/assets/660-init-deb.sh
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
@mdamaceno
mdamaceno / testesavon.rb
Last active December 1, 2015 04:56
Example using WSDL in Ruby
require 'savon'
client = Savon.client(wsdl: 'http://tadeuclasse.zz.mu/WSCartao/Server.php?wsdl')
response = client.call(:validar_cartao, message: {
tDadosCartao: {
"NumeroCartao" => "4522669988574455",
"Codigo" => "168",
"NomeCliente" => "Marco Damaceno",
"Validade" => "201612",
"Valor" => "150",
{
"estados": [
{
"sigla": "AC",
"nome": "Acre",
"cidades": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
"Bujari",
@mdamaceno
mdamaceno / sublime-settings
Created March 20, 2015 14:49
Sublime Settings
{
"auto_complete_selector": "text.html.erb, source - comment, meta.tag - punctuation.definition.tag.begin",
"bold_folder_labels": false,
"caret_extra_width": 1,
"caret_style": "phase",
"close_windows_when_empty": false,
"color_scheme": "Packages/Boron Color Scheme/Boron.tmTheme",
"detect_indentation": false,
"drawCentered": true,
"draw_minimap_border": true,
@mdamaceno
mdamaceno / sublimesettings
Created November 19, 2014 12:14
Sublime User Settings
{
"auto_complete_selector": "text.html.erb, source - comment, meta.tag - punctuation.definition.tag.begin",
"bold_folder_labels": false,
"caret_extra_width": 1,
"caret_style": "phase",
"close_windows_when_empty": false,
"color_scheme": "Packages/Dayle Rees Color Schemes/legacy/Turnip.tmTheme",
"detect_indentation": false,
"drawCentered": true,
"draw_minimap_border": true,
@mdamaceno
mdamaceno / inputs.js
Created September 17, 2014 20:48
Formato campos
"<input class='hidden' type='hidden' id='demand_item' name='demand[item][]' value='" + item + "'>" +
"<input class='hidden' type='hidden' id='demand_product_id' name='demand[product_id][]' value='" + product + "'>" +
"<input class='hidden' type='hidden' id='demand_collection_id' name='demand[collection_id][]' value='" + collection + "'>" +
"<input class='hidden' type='hidden' id='demand_color_id' name='demand[color_id][]' value='" + color + "'>" +
"<input class='hidden' type='hidden' id='demand_quantity' name='demand[quantity][]' value='" + quantity + "'>" +
"<input class='hidden' type='hidden' id='demand_width' name='demand[width][]' value='" + width + "'>" +
"<input class='hidden' type='hidden' id='demand_height' name='demand[height][]' value='" + height + "'>" +
"<input class='hidden' type='hidden' id='demand_model_id' name='demand[model_id][]' value='" + model + "'>" +
"<input class='hidden' type='hidden' id='demand_completion_id' nam
#!/bin/sh
echo "------------------------------------------------------"
echo " Initial Configuration Ubuntu: By Marco Damaceno "
echo "------------------------------------------------------"
# System upgrade
echo "Updating repositories and upgrading system"
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
clear