Skip to content

Instantly share code, notes, and snippets.

View RELATO's full-sized avatar
🎯
Focusing

Haroldo S. Lontra Jr. RELATO

🎯
Focusing
View GitHub Profile
@RELATO
RELATO / tomcat.conf
Created November 23, 2015 17:56
Tomcat service - upstart - ubuntu
description "Tomcat Server"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
respawn limit 10 5
# run as non privileged user
# add user with this command:
## adduser --system --ingroup www-data --home /opt/apache-tomcat apache-tomcat
@RELATO
RELATO / backup.sh
Created November 9, 2015 10:19
Backup mysql and folder sample script
#!/bin/sh
# crontab ( adicionar a linha para backup as 5:15 todos os dias
# 15 5 * * * root /usr/bin/backup.sh
#
# para rodar sem senha crie uma chave publica e privada e envie a publica para as maquinas que voce
# quer fazer o backup:
# ssh-keygen -t dsa -f ~/.ssh/id_dsa
# cat ~/.ssh/id_dsa.pub | ssh root@maquina_remota 'cat - >> ~/.ssh/authorized_keys'
# cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
@RELATO
RELATO / iptables-sample.sh
Created November 9, 2015 10:05
iptables script sample
#!/bin/sh
# Drop ICMP echo-request messages sent to broadcast or multicast addresses
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
# Drop source routed packets
echo 0 > /proc/sys/net/ipv4/conf/all/accept_source_route
# Enable TCP SYN cookie protection from SYN floods
echo 1 > /proc/sys/net/ipv4/tcp_syncookies
# Don't accept ICMP redirect messages
echo 0 > /proc/sys/net/ipv4/conf/all/accept_redirects
@RELATO
RELATO / iRedMail-Group.txt
Last active November 21, 2016 18:21
iRedMail - Creating group of addresses (simple)
Hi,
I read in a post about adding alias addresses.
mysql> USE vmail;
mysql> INSERT INTO alias (address, goto, domain) VALUES ('EmailUserAlias@example.net', 'EmailUser@example.net', 'example.net');
How can I add multiple goto addresses? Can I do this through phpmyadmin adding each address in separate line in the goto field?
Re: Multiple addresses for alias mail
@RELATO
RELATO / iRedMail-forwarding.txt
Created October 25, 2015 21:52
iRedMail - How to forward mail to another account
Re: [SOLVED] Email forwarding with iRedMail - How to?
- For MySQL backend, you can create new record in table "vmail.alias". for example:
mysql> UPDATE alias SET goto='user@external.com,another@external.com' WHERE username='user@your_domain.com';
- For OpenLDAP backend, you can add attribute "mailForwardingAddress" in user object. For example:
dn: mail=user@your_domain.com,ou=Users,domainName=your_domain.com,o=domains,dc=xxx,dc=xxx
mail: user@your_domain.com
@RELATO
RELATO / index.jsp
Created October 25, 2015 12:05
index.jsp to redirect to another site
<%@ page import="java.io.*,java.util.*" %>
<html>
<head>
<title>Page Redirection</title>
</head>
<body>
<center>
<h1>Page Redirection</h1>
</center>
<%
@RELATO
RELATO / AtualizaSeq.java
Created October 23, 2015 11:32
Java program to update _seq hibernate sequence table style
package br.com.relato.util;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Iterator;
# https://wiki.zimbra.com/wiki/ZCS_to_ZCS_rsync_Migration
rsync --delete -axvzKHS [source-location] [newserver-IP-address]:[destination-location]
{"cards":[{"lastEditDate":"2020-03-06T02:06:53.269Z","id":"8rik7fjg2fp","archived":false,"title":"Untitled Card","text":"\n## New card\n### Shortcuts\n- ESC to **Discard Changes**\n- Ctrl+Enter to **Save Changes**\n- Double click on card to **Edit**\n- A to **Add**\n","board":"INBOX","color":"#a7c0cd","isEditing":true,"editingColor":"#a7c0cd","editingTitle":"README","editingText":"# \n\n> MDyna is a markdown notes application that syncs with Github gists, and much more\n---\n\n## 🏠 Homepage\n\nVisit our Landing Page [here](https://mdyna.dev)\n\n## Main Features\n\n* Git Flavoured Markdown \\(GFM\\) support\n* macOs \\+ Windows \\+ Linux\n* Code syntax highlighting for several languages\n* Dark Mode\n* Tag notes with labels\n* Organize cards through boards\n* Cloud syncing through custom directory\n* Github gist sync\n* Export boards as markdown files\n* Import .md files from directory\n\n\n## Author\n\n👤 **David Morais**\nhhj\n* Twitter: [@Psybork](https://twitter.com/Psybork)\n* Github: [@mdyna](https://gith
Top section is for regular Ubuntu installs. Bottom section is for EC2 installs.
Ubuntu Login as Root (regular Ubuntu VM or PC – not using AWS EC2)
Login with main user
Now gain root access to bash, by emulating it with sudo
# sudo -i