Skip to content

Instantly share code, notes, and snippets.

View sloev's full-sized avatar
https://www.buymeacoffee.com/sloev

sloev sloev

https://www.buymeacoffee.com/sloev
View GitHub Profile
@sloev
sloev / ipfs gossip libp2p nodejs example server with http api.md
Last active September 17, 2020 05:53
ipfs gossip libp2p nodejs example server with http api

npm install npm start

@sloev
sloev / bigquery_data_transfer_jobs.py
Last active September 12, 2023 19:41
how to use bigquery transfer service from python for cross regional dataset copy on schedule
"""
How to create cross-region scheduled bigquery dataset copy jobs in GCP using python
______________________________________________________________
* use python 3.7+
* install requirements
google-api-python-client==1.12.8
google-auth==1.23.0
google-auth-oauthlib==0.4.2
<!DOCTYPE html>
<html lang="en">
<body>
<button id="button">play greeting</button>
<script>
const greeting = () => {
window.speechSynthesis.onvoiceschanged = function () {
window.speechSynthesis.cancel();
window.speechSynthesis.getVoices();
@sloev
sloev / app.py
Last active December 30, 2020 02:04
etag tracking user journey
import msgpack
from typing import Optional
from fastapi import FastAPI, Response
from starlette.requests import Request
from fastapi.responses import HTMLResponse
import crypto
import json
import secrets
app = FastAPI()
<script>
function beep() {
var snd = new Audio("data:audio/wav;base64,//uQRAAAAWMSLwUIYAAsYkXgoQwAEaYLWfkWgAI0wWs/ItAAAGDgYtAgAyN+QWaAAihwMWm4G8QQRDiMcCBcH3Cc+CDv/7xA4Tvh9Rz/y8QADBwMWgQAZG/ILNAARQ4GLTcDeIIIhxGOBAuD7hOfBB3/94gcJ3w+o5/5eIAIAAAVwWgQAVQ2ORaIQwEMAJiDg95G4nQL7mQVWI6GwRcfsZAcsKkJvxgxEjzFUgfHoSQ9Qq7KNwqHwuB13MA4a1q/DmBrHgPcmjiGoh//EwC5nGPEmS4RcfkVKOhJf+WOgoxJclFz3kgn//dBA+ya1GhurNn8zb//9NNutNuhz31f////9vt///z+IdAEAAAK4LQIAKobHItEIYCGAExBwe8jcToF9zIKrEdDYIuP2MgOWFSE34wYiR5iqQPj0JIeoVdlG4VD4XA67mAcNa1fhzA1jwHuTRxDUQ//iYBczjHiTJcIuPyKlHQkv/LHQUYkuSi57yQT//uggfZNajQ3Vmz+Zt//+mm3Wm3Q576v////+32///5/EOgAAADVghQAAAAA//uQZAUAB1WI0PZugAAAAAoQwAAAEk3nRd2qAAAAACiDgAAAAAAABCqEEQRLCgwpBGMlJkIz8jKhGvj4k6jzRnqasNKIeoh5gI7BJaC1A1AoNBjJgbyApVS4IDlZgDU5WUAxEKDNmmALHzZp0Fkz1FMTmGFl1FMEyodIavcCAUHDWrKAIA4aa2oCgILEBupZgHvAhEBcZ6joQBxS76AgccrFlczBvKLC0QI2cBoCFvfTDAo7eoOQInqDPBtvrDEZBNYN5xwNwxQRfw8ZQ5wQVLvO8OYU+mHvFLlDh05Mdg7BT6YrRPpCBznMB2r//xKJjyyOh+cImr2/4doscwD6neZjuZR4AgAABYAAAABy1xcdQtxYBYYZdifkUDgzzXaXn98Z0oi9
@sloev
sloev / render
Created May 18, 2021 12:19
render yaml template and concat
#!/bin/bash
# EXAMPLE:
# $ cat production.env
#
# DB_HOST="foo=bar bas=10"
# DB_PORT=5432
# DB_PASSWORD=$DB_PASSWORD
#
# $ cat test.yaml
@sloev
sloev / git_pre_push_hook_to_prevent_master_push_by_accident.md
Last active February 28, 2022 20:10 — forked from ColCh/README.md
Git pre-push hook to confirm pushing to master

Git pre-push hook

It will check if current branch is master, then ask a confirmation, in case of master branch

install

  1. install a recent version of git (https://git-scm.com/download/mac) eg:

$ brew install git

@sloev
sloev / README.md
Last active August 5, 2021 13:11
rtsp -> python opencv -> rtsp
  1. replace INPUT_RTSP_STREAMLINK and OUTPUT_RTSP_STREAMLINK with rtsp://yadayada
  2. pip install opencv-python numpy tqdm
  3. python process_rtsp_to_image.py
  4. bash publish_image_to_rtsp.sh
import cv2
import csv
import numpy as np
img = cv2.imread("img.png")
data_file = open("data.data", "wb")
csv_file = open("data.csv", "w")