Skip to content

Instantly share code, notes, and snippets.

View gmsotavio's full-sized avatar

Otavio Augusto Gomes gmsotavio

  • Inobram Automações
  • Paraná State, Brazil
  • 10:38 (UTC -03:00)
View GitHub Profile
@gmsotavio
gmsotavio / delete_git_submodule.md
Created March 22, 2024 18:34 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@gmsotavio
gmsotavio / pfctl-cheatsheet.txt
Created November 24, 2023 20:24 — forked from johnbianchi/pfctl-cheatsheet.txt
pfctl cheat sheet
#### General PFCTL Commands ####
$ pfctl -d disable # packet-filtering
$ pfctl -e enable # packet-filtering
$ pfctl -q # run quiet
$ pfctl -v -v # run even more verbose
#### Loading PF Rules ####
$ pfctl -f /etc/pf.conf # load /etc/pf.conf
$ pfctl -n -f /etc/pf.conf # parse /etc/pf.conf, but dont load it
$ pfctl -R -f /etc/pf.conf # load only the FILTER rules
$ pfctl -N -f /etc/pf.conf # load only the NAT rules
@gmsotavio
gmsotavio / vpn.md
Created October 2, 2023 02:36 — forked from joepie91/vpn.md
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.
@gmsotavio
gmsotavio / git-commit-styleguide.md
Created December 15, 2022 10:52 — forked from rishavpandey43/git-commit-styleguide.md
This gist consist of the rules and best practice of good conventional git commit message

Git Commit Messages Style-Guides

  • Use the present tense ("Add feature" not "Added feature")
  • Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
  • Limit the first line to 72 characters or less
  • Reference issues and pull requests liberally after the first line
  • When only changing documentation, include [ci skip] in the commit title
  • Consider starting the commit message with an applicable emoji

Types

@gmsotavio
gmsotavio / ipfw.sh
Created October 12, 2022 19:06 — forked from Jehops/ipfw.sh
ipfw config
#!/bin/sh
# This is an attempt at an ipfw config for a cluster with a master node and many
# compute nodes. The master node is acting as a gateway for the compute nodes
# in the LAN (192.168.0.0/24).
#
# A jail running on one of the compute nodes with address 192.168.0.118 is to be
# accessible from the outside (using redirect_addr 192.168.0.118
# 129.173.118.118). The address 129.173.118.118 is an alias for the WAN
# interface that will only be used to direct traffic to this jail.
@gmsotavio
gmsotavio / sysctl.conf
Created October 11, 2022 11:38 — forked from pautiina/sysctl.conf
calomel.org freebsd network tuning
# FreeBSD 10.2 -- /etc/sysctl.conf version 0.47
# https://calomel.org/freebsd_network_tuning.html
#
# low latency is important so we highly recommend that you disable hyper
# threading on Intel CPUs as it has an unpredictable affect on latency, cpu
# cache misses and load.
#
# These settings are specifically tuned for a "low" latency FIOS (300/300) and
# gigabit LAN connections. If you have 10gig or 40gig you will need to increase
# the network buffers as proposed. "man tuning" for more information.
@gmsotavio
gmsotavio / csumattr.sh
Created May 28, 2022 19:51 — forked from tsmetana/csumattr.sh
Store file checksum in the extended attribute
#!/usr/bin/bash
#
# Set/check SHA256 file checksum stored in the file's extended attributes
#
csum_attr="user.sha256sum"
check_path="."
action=""
usage() {
@gmsotavio
gmsotavio / ufw_vpn_killswitch_tutorial.md
Created October 18, 2020 22:09 — forked from Necklaces/ufw_vpn_killswitch_tutorial.md
GNU/Linux UFW VPN kill switch tutorial

GNU/Linux UFW VPN kill switch tutorial

This is a quick guide for setting up a kill switch using UFW (Uncomplicated FireWall). It is assumed you are using OpenVPN and optionally Network-Manager with network-manager-openvpn.

1. (Optional) IP Addresses

Before we can start we're going to need the IP address (or the IP addresses) of your VPN so that we can whitelist those later on, write them down. They are obviously going to be different for every VPN and VPNs with multiple servers, so I'll leave this up to you.

2. Install UFW

On some systems UFW is installed and enabled by default (Ubuntu, for example). Installation procedure is going to be different for every distribution of GNU/Linux, but it's usually something like

@gmsotavio
gmsotavio / bash_to_zsh_history.rb
Created November 23, 2018 19:13 — forked from goyalankit/bash_to_zsh_history.rb
Import bash history to zsh history.
#################################################################
# = This script transfers bash history to zsh history
# = Change bash and zsh history files, if you don't use defaults
#
# = Usage: ruby bash_to_zsh_history.rb
#
# = Author: Ankit Goyal
#################################################################
# change if you don't use default values