Skip to content

Instantly share code, notes, and snippets.

View fallenflint's full-sized avatar

Flint fallenflint

  • Saint Petersburg
View GitHub Profile
@fallenflint
fallenflint / app.py
Created August 5, 2019 18:03
Example application which leads all over training process via Python CLI
import logging
import os
import sys
import time
from auger.api.dataset import DataSet
from auger.api.model import Model
from auger.api.project import Project
from auger.api.experiment import Experiment, AugerExperimentSessionApi
from auger.api.utils.context import Context
@fallenflint
fallenflint / poland_eval.py
Last active July 14, 2016 13:57
Poland Notation Simple evaluator
import unittest
class PolandTestCase(unittest.TestCase):
def test_basic(self):
self.assertEqual(poland_eval('2 4 + 2 *'), 12)
def test_space_agnostic(self):
res1 = poland_eval('2 4+2*')
res2 = poland_eval('2 4 + 2*')
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import SocketServer
import SimpleHTTPServer
import urllib
import socket
import argparse
import webbrowser
import re
@fallenflint
fallenflint / circular_primes.py
Last active April 5, 2016 19:12
My solutions of beatmycode.com challenges. "Digit sum", "Circular primes" and "Turtle pyramid" - most interesting of those challenges.
"""
A number is called a circular prime if all of its rotations (rotations of their digits) are primes themselves.
For example the prime number 197 has two rotations: 971, and 719. Both of them are prime, so all of them are circular primes.
There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97.
How many circular primes are there below N if 1 <= N <= 1000000?
"""
from math import sqrt
import socket
from xml.etree import ElementTree as ET
import logging
from django.conf import settings
from .exceptions import TransactionError
if settings.PREMIERE_LOG_TO_DB:
from ..models import RequestLog