Skip to content

Instantly share code, notes, and snippets.

View elvisoliveira's full-sized avatar
😄
1% talent.. 99% not being distracted by the internet

Elvis Oliveira elvisoliveira

😄
1% talent.. 99% not being distracted by the internet
View GitHub Profile
@elvisoliveira
elvisoliveira / ARTICLE.md
Last active January 27, 2025 16:24
SSH over proxy
ssh USERNAME@HOST -o "ProxyCommand corkscrew PROXY_HOST PROXY_PORT %h %p ~/corkscrew-auth"

Using PHP and Twig as a Static Site Generator

In the world of static site generators, there are numerous tools that help you create static websites with little to no server-side processing. However, sometimes a simple and lightweight solution is all you need. This is where using PHP and Twig as a static site generator comes in. Although it may seem like a bit of a hack, it’s a viable option for simple projects that don’t require a large or diverse content management system.

Why PHP and Twig?

When building static websites, the main goal is usually to serve pre-rendered content that is fast and easy to deploy. PHP, a well-known server-side scripting language, has built-in functionalities that make it an excellent tool for quickly processing data and rendering templates. Twig, on the other hand, is a flexible and powerful template engine that integrates seamlessly with PHP.

By using PHP's built-in features, you can fetch and parse payloads that will serve as the general-purpose data for the site. This

@elvisoliveira
elvisoliveira / config.rb
Last active December 13, 2024 19:12
Simple data pagination on Ruby's middleman SSG
redirect "photos.html", to: "photos_1.html"
ready do
photos = @app.data.photos
start_index = 0
page_num = 1
per_page = 8
while start_index <= photos.size
proxy "photos_#{page_num}.html", "gallery.html", :locals => {

Creating a Restricted Wi-Fi Network on Linux

In certain network environments, it can be necessary to restrict web browsing on connected devices while allowing access to other services, such as SSH. One way to achieve this is by setting up a custom Wi-Fi hotspot that enforces selective network blocking. This article explores how to accomplish this setup using Linux tools, specifically ebtables for firewall rules and tcpdump for monitoring traffic.

Project Overview

In this setup, two machines were used: a “host” machine, which created the Wi-Fi hotspot, and a “client” machine, which connected to it. The host was configured to selectively block web browsing by dropping packets on HTTP and HTTPS ports, while still allowing access to the host’s SSH server.

To establish the Wi-Fi network, the linux-wifi-hotspot tool was used. This open-source project leverages [hostapd](https://en.w

ffmpeg -ss 00:28:31 -i "Reunião do meio de semana_ 26 de agosto – 1 de setembro_r720P.mp4" -to 00:02:33 -c copy "Iniciando conversas 01.mp4"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Banco Central - Sistema Gerenciador de Séries Temporais

O resultado nominal é um indicador que mostra o saldo fiscal total, incluindo tanto o resultado primário (diferença entre receitas e despesas antes do pagamento de juros) quanto os juros da dívida pública. Ele é chamado de nominal porque reflete todas as obrigações do governo, incluindo os custos financeiros associados à dívida. Essa é uma métrica essencial para avaliar:

  • O desempenho fiscal do governo.
  • A necessidade de financiamento para cobrir déficits.
  • A evolução da dívida pública considerando os fluxos financeiros mensais.

Para acessar os dados de estatísticas fiscais no Sistema Gerenciador de Séries Temporais (SGS) do Banco Central do Brasil, comece acessando o SGS por meio do site oficial do Banco Central. Na interface do sistema, utilize o painel à esquerda onde estão as opções de busca. Escolha a opção "Localizar séries", que permite pesquisar por diferentes critérios, como tema, código, fonte ou

@elvisoliveira
elvisoliveira / daily-text.py
Last active April 30, 2024 11:21 — forked from alissa-maria/daily-text.py
Prints daily text + explanation to stdout
import requests
from bs4 import BeautifulSoup
url = 'https://wol.jw.org/en/wol/h/r1/lp-e'
response = requests.get(url)
html_content = response.content
soup = BeautifulSoup(html_content, 'html.parser')
#!/bin/bash
CERT="-----BEGIN CERTIFICATE-----
MIIDazCCAlOgAwIBAgIUM5oufPCCXzuMqbEyOF66XLoWp4gwDQYJKoZIhvcNAQEL
...
xRuyv0aVU1RiCAURKATJ
-----END CERTIFICATE-----"
HASH=`openssl x509 -pubkey -noout -in <(echo "$CERT") |
openssl pkey -pubin -outform der |
openssl dgst -sha256 -binary |