Skip to content

Instantly share code, notes, and snippets.

View 0x3333's full-sized avatar

TFGF 0x3333

  • 19:01 (UTC -03:00)
View GitHub Profile
@0x3333
0x3333 / README.md
Created May 23, 2024 15:35
List issued/revoked Easy-RSA/OpenVPN certificates

This script should be placed in the directory that has the easy-rsa directory.

Example output:

# ./list-revoked
Revoked certificates:
=====================

757605D0E1B900FEBEBD0DB92B7CBCD7: C - someuser1
@0x3333
0x3333 / .zshrc
Created March 18, 2022 13:42
Initialize jenv only if inside a Java folder
function evaluate_jenv() {
if [ ! -v JENV_LOADED ]; then
setopt local_options nullglob
[ -f pom.xml -o -f build.gradle.kts -o -f build.sbt -o -f build.xml -o -f .java-version -o -f .deps.edn -o -f project.clj -o -f build.boot ] && files=1
if [ ! -v files ]; then
extensions=(*.java, *.class, *.gradle, *.jar, *.cljs, *.cljc)
if [ -z "$extensions" ]; then
return
fi
fi
@0x3333
0x3333 / README.md
Created March 9, 2021 15:27
Generate random passwords

Generate random passwords using 4 different charsets. Configurable length and count(Default 32 len, 30 count).

Usage:

./genpass
Usage: ./genpass [length(32)] [passwords_count(30)]

20973143392597200522372078343494   9gdds8ihw2niigs3f4gzddv9rtfmv8kx   dlaoEefHJJxN6oqglazb5RgstmD9z144   ,i-UIZVNd|~9$Z'5=J@=RVt{nIV+J{a&
45656053506377489597126894570217   up34vlejddl3vnj5n7m38733myv8dkx1   9wJLm8nCwN0AhHznsod2VyX7S5Yhd0ah   ^#y-@GBRTX&BTi @oJZO9f8K:9tUVTbU
@0x3333
0x3333 / README.md
Created March 9, 2021 15:20
Show fingerprints of SSH authorized keys

This scripts shows all fingerprints of SSH authorized keys for the root user.

This is usefull when you are checking which key has been accepted in the /var/log/auth.log.

Like:

Mar  9 10:13:08 hnm sshd[1595179]: Accepted publickey for root from 192.168.1.1 port 56726 ssh2: ED25519 SHA256:OLcfsyZasQWbXze7TVirQd42O09YB704i1N8pKOuve5u
@0x3333
0x3333 / prompt_0x3333_2_setup
Last active January 21, 2021 14:12
ZSH 0x3333 Prompt Variation
#
# Authors:
# Tercio Gaudencio Filho <[email protected]>
#
# Ex:
# USERNAME@HOSTNAME [TIME] [/FULL/PATH] ✘ $
function prompt_0x3333_2_setup {
setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS
@0x3333
0x3333 / README.md
Created July 24, 2020 11:46
TLC5973 driver in Golang for Raspberry Pi

This is a simple example on how to interface with a TLC5973 IC to dim LEDs in Raspberry Pi.

It uses SPI to generate a pulse train with precise timing.

In Raspberry Pi, the SPI may have some inter-byte delay, which makes this useless. More here: https://www.raspberrypi.org/forums/viewtopic.php?t=211152

I'm using go-rpio to manage the SPI device.

The idea to use SPI came from this repo: https://github.com/mik4el/cc1350-swim-thermo/blob/b2fdb54a940e18911959a5e1778ca7fc06915a11/software/tlc5973_spimaster_CC1350_SWIMTHERMO_tirtos_ccs/spimaster.c

@0x3333
0x3333 / nginx.conf
Created March 11, 2020 14:56
Block write to Docker Registry in Nginx with basic auth
server {
listen 80;
server_name docker.yourdomain.com;
return 301 https://$server_name$request_uri;
}
upstream registry {
server 192.168.3.10:5000;
@0x3333
0x3333 / updateFreeDNS.sh
Created September 19, 2019 16:31
Updated FreeDNS script to use dig to check the IP in the Master name server instead of local name server.
#!/bin/sh
#FreeDNS updater script
UPDATEURL="https://freedns.afraid.org/dynamic/update.php?_YOUR_KEY_HERE_"
DOMAIN="_YOUR_DOMAIN_HERE_"
registered=$(nslookup $DOMAIN|tail -n2|grep A|sed s/[^0-9.]//g)
current=$(dig +noall +answer @ns1.afraid.org $DOMAIN|sed 's/.*\t\([0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\).*$/\1/g')
@0x3333
0x3333 / README.md
Created July 22, 2019 17:29
Pega o saldo da conta SIP Trunk da DirectCall

Para contas tipo SIP Trunk da DirectCall, não existe API(Existe mas é paga) para pegar o saldo atual da conta.

Criei este script para facilitar o acompanhamento do saldo, sem precisar entrar na interface web.

O script retorna 0 caso seja invocado sem argumentos ou caso o argumento seja maior que o saldo atual. Exemplo:

$ ./saldo.sh
312,64
$ echo $?
@0x3333
0x3333 / README.md
Last active November 11, 2023 12:56
List mounted points in columns

This is an alias to shells to display mount output in formatted columns.

Add this alias to your rc shell(.bashrc, .zshrc, or whatever):

alias mountc='mount | column -t | sort -V'

Example output: