Skip to content

Instantly share code, notes, and snippets.

View ricardomaia's full-sized avatar
:octocat:
/** No comments */

Ricardo Maia ricardomaia

:octocat:
/** No comments */
View GitHub Profile
def obter_mais_longa_substring(s):
alfabeto = {'a':1,'b':2,'c':3,'d':4,'e':5,'f':6,'g':7,'h':8,'i':9,'j':10,'k':11,'l':12,'m':13,'n':14,'o':15,'p':16,'q':17,'r':18,'s':19,'t':20,'u':21,'v':22,'w':23,'x':24,'y':25,'z':26}
substrings = []
substring_atual = []
posicao_anterior = 0
for c in s:
posicao_atual = alfabeto[c]
@ricardomaia
ricardomaia / profiles.json
Last active November 29, 2019 02:44
Windows Terminal Settings
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"showTerminalTitleInTitlebar": true,
"profiles": [
{
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
"hidden": false
FOR %i IN (*.webm) DO ffmpeg.exe -fflags +genpts -i "%i" -r 24 "%i.mp4"
@ricardomaia
ricardomaia / sign and verify.txt
Created May 16, 2020 01:30
openssl p7s Let's Encrypt
$ openssl smime -sign -in file.txt -inkey /etc/letsencrypt/live/example.com/privkey.pem -outform PEM -signer /etc/letsencrypt/live/example.com/cert.pem -CAfile /etc/letsencrypt/live/example.com/fullchain.pem -out file.txt.p7s
$ openssl pkcs7 -print_certs -in file.txt.p7s -out file.txt.p7s.cer
$ openssl smime -verify -inform PEM -in file.txt.p7s -content file.txt -certfile file.txt.p7s.cer -CAfile /etc/letsencrypt/live/example.com/fullchain.pem -nointern -noverify > /dev/null
@ricardomaia
ricardomaia / gist:f241008dda8c82e3b23696e3c66cd75a
Last active May 18, 2020 23:33
Measuring script execution time
$ curl https://downloads.wordpress.org/theme/customizr.4.1.44.zip -o customizr.zip
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 7262k 100 7262k 0 0 2791k 0 0:00:02 0:00:02 --:--:-- 4138k
$ time unzip customizr.zip
real 0m2.727s
user 0m0.296s
sys 0m0.339s
@ricardomaia
ricardomaia / webcryptoapi.html
Created May 18, 2020 23:38 — forked from deiu/webcryptoapi.html
Web Crypto API example: RSA keygen & export & import & sign & verify & encrypt & decrypt
<!-- MIT License -->
<html>
<head>
<script>
function generateKey(alg, scope) {
return new Promise(function(resolve) {
var genkey = crypto.subtle.generateKey(alg, true, scope)
genkey.then(function (pair) {
resolve(pair)
})
@ricardomaia
ricardomaia / Dados Pessoais.md
Created February 10, 2021 22:51
Consulta Dados Pessoais
@ricardomaia
ricardomaia / multiple_selections.gs
Created May 24, 2022 15:37
Multiple Selections on Google Spreadsheets
/**
@OnlyCurrentDoc
Ref: https://spreadsheetpoint.com/multiple-selection-drop-down-google-sheets/
*/
function onEdit(e) {
var oldValue;
var newValue;
var ss=SpreadsheetApp.getActiveSpreadsheet();
var activeCell = ss.getActiveCell();
if(activeCell.getColumn() == 3 && activeCell.getRow() >= 4 && ss.getSheetName != "Categorias" ) {

Google Advanced Search

https://www.google.com/advanced_search

Operators

"" Use this to do an exact-match search.

OR Search for this OR that. This will return results related to the two terms or both.

@ricardomaia
ricardomaia / network_scan.md
Created October 19, 2022 17:45
Network scan with shell script and www-data user

Network scan with shell script and www-data user

PING IPs

for i in $(seq 1 10); 
  do ping -c1 -t 1 192.168.0.$i | grep -v '100% packet loss' | grep PING | awk '{print $2}' >> /var/www/html/ips.txt; 
  done;

Probe TCP Ports