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
@ricardomaia
ricardomaia / Regex.MD
Last active March 18, 2024 13:28
Insert a new line each x lines

Insert a new line each x lines

Regex Find: ((?:.*\r?\n){4})

Regex Replace: $0\n

Remove all lines not containing 'word'

Visualizar os campos disponíveis para itemtype ITILCategory

curl --request GET \
  --url https://glpi.exemplo.com.br/apirest.php/listSearchOptions/ITILCategory \
  --header 'App-Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
  --header 'Content-Type: application/json' \
  --header 'Session-Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
@ricardomaia
ricardomaia / Dados Pessoais.md
Created February 10, 2021 22:51
Consulta Dados Pessoais
@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 / 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
FOR %i IN (*.webm) DO ffmpeg.exe -fflags +genpts -i "%i" -r 24 "%i.mp4"
@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 / 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
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]