Skip to content

Instantly share code, notes, and snippets.

View danleyb2's full-sized avatar
:octocat:
...

Nyaundi Brian danleyb2

:octocat:
...
View GitHub Profile
@danleyb2
danleyb2 / platerecognizer-upload-base64.py
Created February 21, 2022 08:42
Encode an Image to Base64 then upload to Platerecognizer API cloud
import base64
import requests
API_TOKEN = '3234232ad2################'
def upload_base64(image_path):
with open(image_path, 'rb') as image_file:
img_base64 = base64.b64encode(image_file.read())
url = 'http://api.platerecognizer.com/v1/plate-reader'
import requests
import json
API_TOKEN = '4805bee1222ce85e0bf####################'
regions = ['us-ca', ]
config = dict(
detection_mode='vehicle'
)
@danleyb2
danleyb2 / regex-compile-perf.js
Last active July 15, 2022 07:39
Regex Pre-Compilation Performance difference
const RUNS = 100000;
// PRE-COMPILE REGEX
console.time('processRequest1')
const regex = RegExp(/^camera-([0-9]+)/)
function processRequest1(){
let camId = regex.exec('camera-1')
return camId
}
import requests
import json
import base64
import os
config = {
"40.png": {"black", "white", "blue", "yellow"},
"38.png": {"blue", "white"},
"20.png": {"black","white", "yellow", "blue"},
"30.png": {"yellow", "blue", "white"},
using System;
using System.IO;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using HttpMultipartParser;
namespace WebhookReceiver
{
internal class HttpServer
@danleyb2
danleyb2 / semantic-commit-messages.md
Created September 7, 2022 20:33 — forked from joshbuchea/semantic-commit-messages.md
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example