Skip to content

Instantly share code, notes, and snippets.

@app.route('/images')
def show_images():
return render_template('images.html', images=os.listdir('static/images'))
<!DOCTYPE=html>
<html>
<body>
{% for img in images %}
<h1 > {{img}} </h1>
<img src="images/{{img}}" alt="{{img}}">
{% endfor %}
</body>
</html>`
func setupSystray() {
data, err := Asset("images/bitmap.ico")
if err != nil {
fmt.Println("Icon reading error", err)
return
}
systray.SetTemplateIcon(data, data)
systray.SetTitle("Insert Date")
package main
import (
"log"
"syscall"
"unsafe"
)
type keyboardInput struct {
wVk uint16
package main
// Keycodes maps keys to their respective virtual key code from https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
var Keycodes = map[string]uint16{
" ": 0x20,
"-": 0xBD,
"0": 0x30,
"1": 0x31,
"2": 0x32,
"3": 0x33,
// MSG see https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-msg
type MSG struct {
HWND uintptr
UINT uintptr
WPARAM int16
LPARAM int64
DWORD int32
POINT struct{ X, Y int64 }
}
import (
"bytes"
"fmt"
"strings"
"syscall"
"time"
"unsafe"
)
func main() {
// HOTKEYS to listen to
var HOTKEYS = map[int16]*Hotkey{
1: &Hotkey{4, ModAlt + ModCtrl, 'D'},
}
const (
ModAlt = 1 << iota
ModCtrl
ModShift
ModWin
import numpy as np
import cv2
# frame dimensions should be square
PREPROCESS_DIMS = (300, 300)
def read_labels(label_map_path = 'models/labelmap.prototxt'):
CLASSES = []
with open(label_map_path) as f:
lines = f.readlines()
#!/bin/bash
export FLASK_APP=server.py
python3 -m flask run