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 22, 2024 21:46
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}
@bludnic
bludnic / regexp_replace.sql
Created July 23, 2018 14:25
REGEXP_REPLACE for mysql
/* SELECT test */
SELECT ID, reg_replace(post_content, '<aside class="mashsb-container(.*)">((.|\n)*)<\/aside>', '', TRUE, 2, 0) as content
FROM wp_posts
WHERE post_content REGEXP('<aside class="mashsb-container(.*)">((.|\n)*)<\/aside>')
LIMIT 1
/* Update */
UPDATE wp_posts
SET post_content = REGEXP_REPLACE('post_content', '<aside class="mashsb-container(.*)">((.|\n)*)<\/aside>', '')
WHERE ID = 469
@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 May 7, 2024 07:28
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)