Skip to content

Instantly share code, notes, and snippets.

View guicattani's full-sized avatar
🐱

Guilherme Cattani guicattani

🐱
  • Berlin
View GitHub Profile
@guicattani
guicattani / find_commented_code.arb
Created May 24, 2021 13:42
Find commented code in Ruby
#!/usr/bin/env ruby
ARGV.each do |filename|
fileobject = File.new(filename, "r")
next if fileobject.nil?
occurences = 0
lines = fileobject.readlines
lines.each do |line|
next unless line.match(/\A *#.+\n/)
@guicattani
guicattani / squid.conf
Created November 14, 2020 19:14
squid config
acl localnet src 0.0.0.1-0.255.255.255
acl localnet src 10.0.0.0/8
acl localnet src 100.64.0.0/10
acl localnet src 169.254.0.0/16
acl localnet src 172.16.0.0/12
acl localnet src 192.168.0.0/16
acl localnet src fc00::/7
acl localnet src fe80::/10
acl SSL_ports port 443
acl Safe_ports port 80
@guicattani
guicattani / traverse_folder_recursively.sh
Created September 10, 2019 19:43
Script to traverse through all folders and files inside a given folder, second argument is indentation level
#!/bin/bash
folder="$1"
add_space_indentation () {
for i in $(eval echo "{1..$1}")
do
echo -n '-'
done
}
@guicattani
guicattani / .bash
Created September 7, 2019 15:35
Set up GIT and SSH key
git config --global user.name "NAME"
git config --global user.email "YOUR@MAIL.COM"
ssh-keygen -t rsa -C "YOUR@MAIL.COM"
git config --list #verify configs
cat /home/USER/.ssh/id_rsa.pub
#create new SSH key in git hub and copy the key, including email
ssh -T git@github.com
@guicattani
guicattani / .bashrc
Created September 7, 2019 15:31
Add to ~/.bashrc to show git branch in terminal
git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
PS1='\e[38;5;10m\[[\u@\h\[\033[37m\]\w\e[38;5;10m\]]\[\033[33m\]$(git_branch)\e[38;5;10m\$ \e[0m'
export PS1