Skip to content

Instantly share code, notes, and snippets.

View niltonvasques's full-sized avatar
🎯
Focusing

Nilton Vasques niltonvasques

🎯
Focusing
View GitHub Profile
@niltonvasques
niltonvasques / knockd_generator.sh
Created October 13, 2019 01:18
Generate knockd configuration file
#!/bin/bash
PINS=$1
HOSTNAME=$2
USERNAME=$3
PINDIPS=`shuf -i 1024-65534 -n $PINS`
OUTLOCK="knockd.conf"
# CHECK SYNTAX
@niltonvasques
niltonvasques / dpms_privacy_policy.md
Last active November 19, 2021 16:57
DPMS Privacy Policy

Privacy Policy

KAEFER built the DPMS app as a commercial app. This SERVICE is provided by KAEFER to its internal companies and is intended for use as is.

This page is used to inform visitors regarding our policies with the collection, use, and disclosure of Personal Information if anyone decided to use our Service.

If you choose to use our Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that we collect is used for providing and improving the Service. We will not use or share your information with anyone except as described in this Privacy Policy.

The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is accessible at DPMS unless otherwise defined in this Privacy Policy.

@niltonvasques
niltonvasques / audit_ssh_logins.sh
Last active July 5, 2021 18:35
Easily identify the accepted SSH Logins in a Linux Host - bash < <(curl -s -L https://git.io/Jc6hV)
#!/bin/bash
# ssh_sha256_owners.txt file should be generated by finding the SHA256 fingerprint
# for each line present inside .ssh/authorized_keys with
# ssh-keygen -lf /tmp/user_key.pub >> ssh_sha256_owners.txt
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
EMPTY=" "
@niltonvasques
niltonvasques / replace.viml
Last active August 2, 2018 18:03
Replace in many files using vim
args **/**.js.erb | argdo execute '%s/<%= I18n.t \(.*\) %>/I18n.t(\1)/g' | update
@niltonvasques
niltonvasques / install_docker.sh
Created December 12, 2017 00:28
Script to bootstrap drone in a empty server
#!/bin/bash
apt-get update
apt-get install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
apt-key fingerprint 0EBFCD88
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
apt-get update
apt-get install -y docker-ce fail2ban
docker run hello-world
@niltonvasques
niltonvasques / pre-commit-msg
Created August 24, 2017 05:42
Put pronto warnings on git commit msg
# .git/hooks/pre-commit-msg
#!/bin/sh
echo "# Pronto Violations:" >> $1
bundle exec pronto run -c upstream/master | sed -e 's/^/# /' >> $1
@niltonvasques
niltonvasques / git_author_stats.sh
Created July 21, 2017 04:27
Collect some metrics from some author on git history
#!/bin/bash
AUTHOR=zequinha
git log origin/master..HEAD --shortstat --author=$AUTHOR | grep "files changed" | awk '{ FILES += $1; INS += $4; DEL += $6 } END { print FILES,INS,DEL }'
@niltonvasques
niltonvasques / split_pdf_pages.sh
Created July 18, 2017 03:05
Split a pdf in individual pdf files
#!/bin/bash
PAGES=17
PDF_FILE=full.pdf
for i in $(seq 1 $PAGES); do
gs -dBATCH -sOutputFile="page$i.pdf" -dFirstPage=$i -dLastPage=$i -sDEVICE=pdfwrite $PDF_FILE;
done
@niltonvasques
niltonvasques / .bashrc
Last active May 31, 2017 21:51
Bash functions to stream and play youtube video and audio
# Install: https://github.com/rg3/youtube-dl/
# USAGE:
# play_youtube https://www.youtube.com/watch?v=4HLaOmiwV5Q&list=PLsVoIP7pW8g984pIJuKXhY9tTG1DiJWY9
function play_youtube(){
mplayer -fs -quiet $(youtube-dl -g -t "$1")
}
# USAGE:
# play_youtube_audio https://www.youtube.com/watch?v=4HLaOmiwV5Q&list=PLsVoIP7pW8g984pIJuKXhY9tTG1DiJWY9
function play_youtube_audio(){
@niltonvasques
niltonvasques / detect_page_change.sh
Created February 17, 2017 19:11
Detect page changes and emit a high beep
# lynx --dump URL > old.html && watch -n 10 "./detect_page_change.sh"
#
#!/bin/bash
RESULT=`diff old.html <(lynx --dump URL)`
if [ "x`printf '%s' "$RESULT" | tr -d "$IFS"`" = x ]; then
echo "NOTHING NEW"
else
( speaker-test -t sine -f 1000 )& pid=$! ; sleep 3.1s ; kill -9 $pid