Skip to content

Instantly share code, notes, and snippets.

View silasrm's full-sized avatar

Silas Ribas Martins silasrm

View GitHub Profile
1. sendScreenShot (front-end js) method uses subsciber.getImgData() method to capture screenshot of the subscriber (remote participant) and post it to the server.
2. On the server we use detectFace() method to detect the facial features in this image and we get a identifier for the detected face (id1)
3. we use detectFace() again with the image we want to compare with and we get identifier for the detected face (id2)
4. we use verifyFace() method and pass id1 and id2 as the inputs. Microsoft face API compares these two faces and provides a result that includes match/mismatch as well as a score.
Reference -
1. getImgData() - https://tokbox.com/developer/sdks/js/reference/Subscriber.html#getImgData
2. Microsoft Face API - https://westus.dev.cognitive.microsoft.com/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f30395236
@valterh4ck3r
valterh4ck3r / localization.dart
Last active April 16, 2024 04:13
Portuguese BR Localization Flutter
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:intl/date_symbol_data_local.dart' as intl;
import 'package:intl/intl.dart' as intl;
class _PTBRMaterialLocalizationsDelegate
extends LocalizationsDelegate<MaterialLocalizations> {
@yoyosan
yoyosan / cleancrap.md
Last active October 18, 2023 00:16
How to clean kdetmpdevfsi or .ICEd-unix suspicious files/folders or processes

Problem

I've recently been hacked on my VPS(using Centos 7.6 and CWP up to date) and the following files/folders were created:

  • /tmp/.ICEd-unix
  • /var/tmp/.ICEd-unix
  • /tmp/kdevtmpfsi
  • /var/tmp/kinsing

The following processes were running and using 100% CPU and Memory:

@onamfc
onamfc / AccessToken.php
Last active June 1, 2023 20:18
Add Custom Claims to Passport 8 / Laravel 6
<?php
namespace App\Passport;
use App\User;
use Lcobucci\JWT\Builder;
use Lcobucci\JWT\Signer\Key;
use League\OAuth2\Server\CryptKey;
use Lcobucci\JWT\Signer\Rsa\Sha256;
use Laravel\Passport\Bridge\AccessToken as BaseToken;
@cjgiridhar
cjgiridhar / nested_maps.go
Created February 18, 2019 16:23
Nested Maps in Golang
package main
import "fmt"
func main() {
// shoppingList is a map that has a map inside it
shoppingList := make(map[string]map[string]int)
// veggies key points to veggiesMap
veggiesMap := map[string]int{"onion": 2, "orka": 3}
@rsudip90
rsudip90 / nullHandle_extends.go
Last active January 3, 2024 21:46
database rows null handling in go by extending types
package main
import (
"database/sql"
"encoding/json"
"fmt"
"log"
"time"
"github.com/go-sql-driver/mysql"
@michael-grunder
michael-grunder / consumer.php
Created June 20, 2018 00:38
Example producer and consumer for the new Redis 5.0 stream API
<?php
$opt = getopt('', ['host:', 'port:', 'skey:', 'group:', 'consumer:', 'sleep:']);
$host = isset($opt['host']) ? $opt['host'] : 'localhost';
$port = isset($opt['port']) ? $opt['port'] : '6379';
$skey = isset($opt['skey']) ? $opt['skey'] : 'stream';
$group = isset($opt['group']) ? $opt['group'] : 'group';
$consumer = isset($opt['consumer']) ? $opt['consumer'] : 'Alice';
$sleep = isset($opt['sleep']) ? $opt['sleep'] : 100000;
@aschmelyun
aschmelyun / DetectScroll.vue
Created May 29, 2018 09:19
Detect scrolling to the bottom of a div in Vue.js
<template>
<div class="wrapper">
<div class="box" @scroll="handleScroll">
<p>Your content here...</p>
</div>
<a href="#" v-if="hasScrolledToBottom">Show After Scrolling</a>
</div>
</template>
<script>
export default {
@ibreathebsb
ibreathebsb / upload.js
Last active April 5, 2023 04:43
file upload from dataUrl with axios
// Note: only for modern browser
import axios from 'axios'
// helper function: generate a new file from base64 String
const dataURLtoFile = (dataurl, filename) => {
const arr = dataurl.split(',')
const mime = arr[0].match(/:(.*?);/)[1]
const bstr = atob(arr[1])
let n = bstr.length
const u8arr = new Uint8Array(n)
@siffash
siffash / icu-install.sh
Last active December 6, 2023 13:30 — forked from aminin/icu-install.sh
Install ICU from source and build php-intl with the specific version of ICU
#!/usr/bin/env bash
if [[ -x $(which php) ]]; then
PHP_ICU_VERSION=$(php -r 'echo defined("INTL_ICU_VERSION") ? INTL_ICU_VERSION : "none";')
echo "PHP ICU version: $PHP_ICU_VERSION"
else
echo 'WARNING: PHP not installed'
PHP_ICU_VERSION=none
fi