Skip to content

Instantly share code, notes, and snippets.

View bergpb's full-sized avatar
💻
https://blog.bergpb.dev

Lindemberg Barbosa bergpb

💻
https://blog.bergpb.dev
View GitHub Profile
@bergpb
bergpb / install_speedtest_armf.sh
Last active November 12, 2022 23:03
Install Speedtest CLI in armf devices
mkdir -pv /home/$USER/.local/bin && \
cd /tmp && wget -c https://install.speedtest.net/app/cli/ookla-speedtest-1.1.1-linux-armhf.tgz && \
tar -xvf ookla-speedtest-1.1.1-linux-armhf.tgz && \
chmod +x speedtest && \
mv speedtest /home/$USER/.local/bin && \
speedtest --accept-license --accept-gdpr
@bergpb
bergpb / install_balena_engine.sh
Last active May 12, 2022 00:08
Install balena-engine
#!/bin/bash
# Special thanks for @rgaudin to share your project
# based on https://github.com/rgaudin/bard-image
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
@bergpb
bergpb / install_node_exporter
Created April 15, 2022 22:11
Install Node Exporter
# https://lukems.com/en/how-to-install-node-exporter-on-linux/
wget https://github.com/prometheus/node_exporter/releases/download/v1.3.1/node_exporter-1.3.1.linux-armv6.tar.gz -O node_exporter-1.3.1.linux-armv6.tar.gz
tar xzvf node_exporter-1.3.1.linux-armv6.tar.gz
sudo cp node_exporter-1.3.1.linux-armv6/node_exporter /usr/local/bin/
sudo useradd -r -s /bin/false node_exporter
@bergpb
bergpb / install_pihole_exporter
Created April 15, 2022 22:11
Install PiHole Exporter
# https://www.observability.blog/monitoring-pi-hole-with-prometheus/
# https://github.com/eko/pihole-exporter
sudo curl https://github.com/eko/pihole-exporter/releases/download/v0.3.0/pihole_exporter-linux-arm --output /usr/local/bin/pihole_exporter
sudo useradd -r -s /bin/false pihole_exporter
# sudo chgrp pihole_exporter /usr/local/bin/pihole_exporter
sudo chown pihole_exporter:pihole_exporter /usr/local/bin/pihole_exporter
@bergpb
bergpb / postgres-cheatsheet.md
Created March 29, 2022 17:14 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@bergpb
bergpb / install.md
Created March 20, 2022 15:43 — forked from Ryanb58/install.md
How to install telnet into a alpine docker container. This is useful when using the celery remote debugger in a dev environment.
>>> docker exec -it CONTAINERID /bin/sh
/app # telnet
/bin/sh: telnet: not found

/app # apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
v3.7.0-243-gf26e75a186 [http://dl-cdn.alpinelinux.org/alpine/v3.7/main]
v3.7.0-229-g087f28e29d [http://dl-cdn.alpinelinux.org/alpine/v3.7/community]
@bergpb
bergpb / youtube_clean_watch_later_videos.js
Last active May 26, 2021 16:07 — forked from qoomon/youtube_clean_watch_later_videos.js
Clean YouTube Watch Later Videos
// This script will remove all videos from watch later list
//
// Usage
//
// #1 go to https://www.youtube.com/playlist?list=WL
// #2 run following script
// adjust REMOVE_BUTTON_TEXT_MAP if your language is missing
(async function() {
const REMOVE_BUTTON_TEXT_MAP = {
@bergpb
bergpb / SessionTimeout.php
Created February 24, 2021 22:27 — forked from rcaneppele/SessionTimeout.php
Configurando Session-Timeout no PHP
session_start();
$timeout = 600; // Tempo da sessao em segundos
// Verifica se existe o parametro timeout
if(isset($_SESSION['timeout'])) {
// Calcula o tempo que ja se passou desde a cricao da sessao
$duracao = time() - (int) $_SESSION['timeout'];
// Verifica se ja expirou o tempo da sessao
if($duracao > $timeout) {
@bergpb
bergpb / Transfer repository
Created February 16, 2021 16:53 — forked from mandiwise/Update remote repo
Transfer repo from Bitbucket to Github
// Reference: http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/
// See also: http://www.paulund.co.uk/change-url-of-git-repository
$ cd $HOME/Code/repo-directory
$ git remote rename origin bitbucket
$ git remote add origin https://github.com/mandiwise/awesome-new-repo.git
$ git push origin master
$ git remote rm bitbucket
@bergpb
bergpb / git-ftp.sh
Created February 16, 2021 16:44
Uso do git-ftp
# Realiza a sincronização do repositório
git ftp push -b main -u "$FTP_USERNAME" -p "$FTP_PASSWORD" ftp://$FTP_HOST -v
# Realiza o envio apenas dos arquivos alterados
git ftp push -b main -u "$FTP_USERNAME" -p "$FTP_PASSWORD" ftp://$FTP_HOST -v