Skip to content

Instantly share code, notes, and snippets.

View dekoza's full-sized avatar
🏠
Working from home

Dominik Kozaczko dekoza

🏠
Working from home
View GitHub Profile
@dekoza
dekoza / hensel.py
Created December 9, 2021 11:14 — forked from meagtan/hensel.py
p-adic numbers implemented in Python
# 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)
// 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
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),
@dekoza
dekoza / usbloadergx_hdd.md
Created January 15, 2017 21:04 — forked from joshenders/usbloadergx_hdd.md
How to format a USB drive for storing GameCube games

Why do we change the cluster size when formatting USB drives for storing GameCube games?

For loading GC Games with USBLoaderGX via DiosMios/Nintendont, format your usb drive's primary partition as FAT32 with 32KB clusters (also known as blocks). This increases performance by reducing the NUMBER of transactions required to perform a read/write operation at the expense of the (very negligible) LENGTH of time to complete a transaction; since it's reading more data per transaction.

I'm not certain, since I can't find a GameCube disk specification, but I don't think the 32KB cluster size is an attempt to imitate the on-disk storage format of retail GameCube discs; which may or may not be 32KB. Retail Wii discs however, actually DO use 32KB clusters. As far as I can tell, 32KB is simply the highest density of bytes per cluster that is supported by FAT32 and of course, by extension, Wii homebrew storage libraries.

If you're concerned about storage efficiency

# middleware to add GNU Terry Pratchett to django
# point to this class in your MIDDLEWARE_CLASSES
class GNUTerryPratchett(object):
@staticmethod
def process_response(request, response):
response['X-Clacks-Overhead'] = 'GNU Terry Pratchett'
return response