Skip to content

Instantly share code, notes, and snippets.

@MarcelFox
MarcelFox / clear_branches.sh
Last active June 21, 2023 20:22
Clear local branches safely
clear_branches() {
GIT_DIR=".git"
BRANCH_EXIST=$(git branch | awk '!/\*/ && !/main/ && !/development/ && !/staging/ && !/develop/ && !/master/')
if [[ ! -d "$GIT_DIR" ]];
then
echo "directory $GIT_DIR not found"
return
fi;
@MarcelFox
MarcelFox / agenda.sh
Last active March 15, 2023 13:07
bash function for agenda
function agenda() {
DIR_PATH="$HOME/.agenda"
if [ ! -d $DIR_PATH ]; then
mkdir $DIR_PATH
fi
if [ -z "$1" ]
then
if [ ! -f "$DIR_PATH/agenda.txt" ];
then
@MarcelFox
MarcelFox / .emacs
Last active March 15, 2023 13:06
Personal .emacs file
;; inhibit-startup-echo-area-message MUST be set to a hardcoded
;; string of your login name
;; Disable slash screen:
(setq inhibit-splash-screen t)
;; Set global text-mode and activate auto-fill:
(setq-default major-mode 'text-mode)
(setq-default auto-fill-function 'do-auto-fill)
@MarcelFox
MarcelFox / list-grub-entries.sh
Created December 7, 2022 19:19 — forked from nderjung/list-grub-entries.sh
List grub entries
awk -F\' '$1=="menuentry " || $1=="submenu " {print i++ " : " $2}; /\tmenuentry / {print "\t" i-1">"j++ " : " $2};' /boot/grub/grub.cfg
@MarcelFox
MarcelFox / 01_postfix_installer.md
Last active December 17, 2020 20:40 — forked from solusipse/01_postfix_installer.md
Postfix + Dovecot + Postgresql + Postfixadmin + Roundcube + Opendkim

Postfix Installer

Following script may be used for configuring complete and secure email server on fresh install of Debian 9. It will probably work on other distributions using apt-get. After minor changes you'll be able to use it on other Linux distros.

What it does?

02_postfix.sh:

  • Install Postfix and configure it with TLS support.
  • Install Dovecot and configure it's transport on Postfix.
  • Download, extract and correct permissions for Postfixadmin.
  • Download, extract and correct permissions for Roundcube.
@MarcelFox
MarcelFox / iptables.sh
Last active December 15, 2020 04:39 — forked from scorredoira/iptables.sh
iptables rules
# flush iptable rules
iptables -F
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
# Allowing DNS lookups (tcp, udp port 53)
iptables -A OUTPUT -p tcp --dport 53 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -p tcp --dport 53 -m state --state NEW,ESTABLISHED -j ACCEPT
@MarcelFox
MarcelFox / check_vpn.sh
Last active October 19, 2020 17:48
check_vpn.sh
#!/bin/bash
#
# Name: check_vpn
# Version: 1.0
# By MarcelFox
# COLORS & STYLES:
BOLD='\e[1m'
ITALIC='\e[3m'
NO_STL='\e[0m'
@MarcelFox
MarcelFox / dns_cpmail.sh
Created April 8, 2018 15:21
dns_cpmail.sh | checks DMARC, DKIM & SPF of a primary domain of a user.
#!/bin/bash
#
# Name: dns_cpmail
# Version: 1.0
# By MarcelFox
#
# HOW TO WORK WITH?
# As 'root' and in a cPanel server run:
# bash dns_cpmail.sh
#
@MarcelFox
MarcelFox / digger.sh
Created November 5, 2018 12:45
digger.sh
#!/bin/bash
# DIGGER by Fox
# Usage:
# digger http://google.com
if [ $# -eq 0 ]
then
printf "Inform the domain: "
read var_domain
@MarcelFox
MarcelFox / firefox-update.sh
Created July 19, 2018 23:22
Firefox Update Script
#!/bin/bash
# Author: MarcelFox
sudo killall firefox
sudo wget -O firefox.tar.bz2 "https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=pt-BR"
if [ -d /usr/lib/firefox ];
then
sudo rm -rf /usr/lib/firefox