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 / 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

using System;
using System.IO;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using HttpMultipartParser;
namespace WebhookReceiver
{
internal class HttpServer
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"},
@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
API_TOKEN = '4805bee1222ce85e0bf####################'
regions = ['us-ca', ]
config = dict(
detection_mode='vehicle'
)
@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'
def run_rec(i):
print(f'run_rec({i})')
with open(i, 'rb') as fp:
response = requests.post(
'https://container-api.parkpow.com/api/v1/predict/',
data= dict(
# config=c,
),
files=dict(image=fp),
danleyb2@ubuntu-ws:~$
danleyb2@ubuntu-ws:~$ docker scan platerecognizer/alpr
Testing platerecognizer/alpr...
✗ Low severity vulnerability found in xdg-user-dirs
Description: Improper Access Control
Info: https://snyk.io/vuln/SNYK-UBUNTU1804-XDGUSERDIRS-347423
Introduced through: [email protected]
From: [email protected]
version: "3.6"
services:
db:
image: platerecognizer/parkpow-postgres
# restart: unless-stopped
volumes:
- /tmp/parkpow-volumes/postgres:/var/lib/postgresql/data/
environment:
- POSTGRES_DB=parkpow
{
"filename": "car.jpg",
"timestamp": "2021-10-11 05:43:58.514896",
"camera_id": null,
"results": [
{
"box": {
"xmin": 146,
"ymin": 481,
"xmax": 276,