Skip to content

Instantly share code, notes, and snippets.

View ybenitezf's full-sized avatar

Yoel Benítez Fonseca ybenitezf

View GitHub Profile
@ybenitezf
ybenitezf / findd_and_download_by_name.c
Created March 5, 2018 21:25
hvikrecorder control
#include <stdio.h>
#include <iostream>
#include "Windows.h"
#include "HCNetSDK.h"
using namespace std;
int saveRecordFile(int userId,char * srcfile,char * destfile)
{
int bRes = 1;
int hPlayback = 0;
if( (hPlayback = NET_DVR_GetFileByName(userId, srcfile, destfile)) =0; nPos = NET_DVR_GetDownloadPos(hPlayback))
@ybenitezf
ybenitezf / dummy_mod.py
Last active October 8, 2019 21:55
web2py inverse to accessible_query: given a record id, table name and permission returns a query of the users with access
def accessible_to(db, name, table, record_id=0):
"""accessible_query inverse
parameters:
db: DAL instance
name: permission name
table: table name or table object
record_id: record id
retorna: Query
@ybenitezf
ybenitezf / get_dotenv_secret.sh
Created May 28, 2021 01:54
Create a secured secret_key for use with dotenv
echo "SECRET_KEY=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 512 | head -n 1`" > .env
@ybenitezf
ybenitezf / decode_capture.py
Last active May 28, 2021 17:05
Descode "application/x-npy" in sagemaker data capture files to numpy array
from io import BytesIO
import base64
import numpy as np
def decode_capture_out_put(data: str) -> np.array:
bytes_data = base64.decodebytes(data.encode('utf-8'))
stream = BytesIO(bytes_data)
return np.load(stream, allow_pickle=True)