Skip to content

Instantly share code, notes, and snippets.

View nagos's full-sized avatar

Vladimir Yakovlev nagos

View GitHub Profile
def calc(x):
print("-- Calculating")
try:
result = 5 / x
except ZeroDivisionError:
print("-- Expected error, continue")
result = 0
print("-- Result ready")
return result
@nagos
nagos / Dockerfile
Last active February 10, 2023 12:29
Python docker starter package
FROM python:3
WORKDIR /usr/src/app
# COPY requirements.txt ./
# RUN pip install --no-cache-dir -r requirements.txt
COPY hello.py .
CMD ["python", "./hello.py"]
#!/usr/bin/env python3
# https://docs.python.org/3/library/sqlite3.html
import sqlite3
con = sqlite3.connect("tutorial.db")
cur = con.cursor()
cur.execute("CREATE TABLE movie(title, year, score)")
cur.execute("""
@nagos
nagos / listdir_test.py
Created October 26, 2022 13:52
Python dir listing without recursive functions
#!/usr/bin/env python3
import os
root_path = "/"
path_list = [root_path]
while len(path_list):
path = path_list.pop()
try:
<html>
<link rel="stylesheet" href="dist/vue-calendar-heatmap.css"/>
<script src="https://cdn.jsdelivr.net/npm/vue@2.1.6/dist/vue.js"></script>
<script src="dist/vue-calendar-heatmap.browser.js"></script>
<body>
<div id="example">
<calendar-heatmap :values="[{ date: '2020-9-22', count: 6 }]" end-date="2020-12-1"/>
</div>
@nagos
nagos / log_parse.py
Created February 5, 2020 05:23
Python to InfluxDB transfer
#!/usr/bin/env python3
import sys
from influxdb import InfluxDBClient
def process(fname):
with open(fname) as infile:
json_body = []
for line in infile:
d = line.rstrip().split('\t')
@nagos
nagos / captcha_full.ipynb
Created November 15, 2017 09:55
Распознавание капчи на нейронных сетях
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
From ce21fbf37a816189d44d8f91844426a9faa7b129 Mon Sep 17 00:00:00 2001
From: Vladimir Yakovlev <nagos@inbox.ru>
Date: Sat, 7 Jul 2012 23:52:41 +0400
Subject: [PATCH] tools: Fix mingw tools build
mkenvimage does not build due to missed os_support.o and unsupported
file modes S_IRGRP S_IWGRP.
Tested with mingw 4.2.1 on ubuntu 12.04.
Signed-off-by: Vladimir Yakovlev <nagos@inbox.ru>
@nagos
nagos / ft_test.c
Created February 14, 2011 14:14
Пример чтения состояния ножек FT2232H в режиме MPSSE
/*
Пример быстрого чтения ножек FT2232H
Компилировать командой
gcc -Wall ft_test.c -l ftdi -o ft_test
Пример работы
nagos@VOLODJ:~/1$ ./ft_test
write: 1024
read: 1024