Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Dominik Kozaczko dekoza

🏠
Working from home
  • Adverity
  • Poland
View GitHub Profile
@dekoza
dekoza / hensel.py
Created Dec 9, 2021 — forked from meagtan/hensel.py
p-adic numbers implemented in Python
View hensel.py
# Finding roots of polynomials in p-adic integers using Hensel's lemma
from padic import *
from poly import *
def roots(p, poly):
'Yield all roots of polynomial in the given p-adic integers.'
for root in xrange(p):
try:
yield PAdicPoly(p, poly, root)
View xpath-cheatsheet.js
// XPath CheatSheet
// To test XPath in your Chrome Debugger: $x('/html/body')
// http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/
// 0. XPath Examples.
// More: http://xpath.alephzarro.com/content/cheatsheet.html
'//hr[@class="edge" and position()=1]' // every first hr of 'edge' class
View traceback
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/kombu/utils/objects.py", line 42, in __get__
return obj.__dict__[self.__name__]
During handling of the above exception ('backend'), another exception occurred:
File "/usr/local/lib/python3.8/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/usr/local/lib/python3.8/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/python3.8/site-packages/django/core/handlers/base.py", line 113, in _get_response
View pyproject.toml
[tool.poetry]
name = "mygdbproject"
version = "0.1.0"
description = "My graphdb project"
authors = ["Dominik Kozaczko <dominik@kozaczko.info>"]
[tool.poetry.dependencies]
python = "^3.8"
django = "^3.0.8"
django-storages = {extras = ["boto3"], version = "^1.9.1", optional = true}
View wait-for-it.sh
#!/usr/bin/env bash
# Use this script to test if a given TCP host/port are available
# The MIT License (MIT)
# Copyright (c) 2016 Giles Hall
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
@dekoza
dekoza / goodnsgames.md
Last active Apr 13, 2018
Worthy Nintendo Switch games
View goodnsgames.md
  • E - eShop only (to my knowledge)
  • p - physical pending
  • P - physical available
  1. Celeste (E)
  2. Don't Starve (E)
  3. The Binding of Isaac: Afterbirth+ (P)
  4. Flinthook (p)
  5. Super Meat Boy (E)
@dekoza
dekoza / awesome_python.md
Last active Apr 3, 2018
My favorite python-related projects, libraries and apps.
View awesome_python.md

Minder's Favorites

This list is to remind me which projects libraries and apps I consider the most awesome :) It is somewhat based on awesome-python and awesome-django

Productivity

  1. cookiecutter - general tool for project templating
  2. django-cookiecutter - the best template for Django projects; integrated Docker, Celery, MailHog and more
  3. pipenv - python package management done right
@dekoza
dekoza / create.py
Created Sep 11, 2017
PonyORM problem
View create.py
from models import *
c1 = Customer(email="1@1.com")
c2 = Customer(email="2@1.com")
o1 = Order(customer=c1)
o10 = Order(customer=c1)
o12 = Order(customer=c1)
o11 = Order(customer=c1)
o13 = Order(customer=c1)
o2 = Order(customer=c1)
View ahes
minder@mindstorm ~/projekty/own/ahes
$ tree
.
├── mojaapka
│   ├── __init__.py
│   └── moj_modul.py
└── skrypt.py
1 directory, 3 files
minder@mindstorm ~/projekty/own/ahes
View gist:40581fef33ee2309fae55cea4ef20c1e
from random import choice # zwraca losowy element z listy
from numpy import array # macierz (typ danych)
from numpy import dot # iloczyn skalarny
from numpy import random # losowanie macierzy (niestety konflikt nazw)
dane_treningowe = [ # modelujemy AND
[array([1, 0, 0]), 0], # pierwszy element to wzbudzenie, zawsze równy 1
(array([1, 1, 1]), 1),
(array([1, 1, 0]), 1),
(array([1, 0, 1]), 1),