Skip to content

Instantly share code, notes, and snippets.

View jaypsan's full-sized avatar

João Pereira jaypsan

View GitHub Profile
@jaypsan
jaypsan / md-to-pdf-build.sh
Created August 24, 2023 20:09
bash script for md-to-pdf Node JS CLI tool. Iterate through all folders within the script directory and, for each, concatenate all .md files and convert to PDF to ./_dist
for d in ./*/; do
# Trim last "/" from "$d
folderName=${d%*/}
# remove text until last "/"
folderName=${folderName##*/}
# checks if folder name starts with underline (_)
# yes: stop loop here
# no: continue
@jaypsan
jaypsan / Onvif-get-snapshot.js
Last active November 16, 2023 20:52
Get snapshot from IP camera with Onvif protocol and send through express http response
function handler(req, res) {
const {hostname, username, password} = req.body
new Cam({
hostname
, username
, password
}, function(err){
this.getSnapshotUri({protocol:'RTSP'}, function (err, stream){
// Make GET request to snapshot uri from câmera
@jaypsan
jaypsan / RowNumberAsColumn.sql
Created December 13, 2022 13:07
SQLServer: add row number as a column during select
ROW_NUMBER() OVER (ORDER BY table.column)
@jaypsan
jaypsan / CPFMask.sql
Last active December 13, 2022 13:08
SQLServer: padding for selecting CPF column
REPLICATE('0', 11 - LEN(table.column)) + table.column