Skip to content

Instantly share code, notes, and snippets.

View drozdowsky's full-sized avatar
💭
🎬

drozdowsky drozdowsky

💭
🎬
View GitHub Profile
@zablotski
zablotski / sredniaWazonaPwr.js
Last active March 2, 2023 17:15
Skrypt obliczjący średnią ważoną w systemie https://jsos.pwr.edu.pl. Skrypt automatycznie usuwa wpisy z oceną 2.0. Aby obliczyć należy wcisnąć F12 w przeglądarce, otworzyć wkładkę Console i wstawić skrypt. Następnie wcisnąć Enter.
$('td:contains("2.0")').parent().remove(); //usunięcie wpisów z oceną 2
var sum=0; //suma ECTS
var mulSum=0; // suma ECTS * ocena
$('td[title="ocena"]').each(function(){
mulSum += parseFloat($(this).text()) * parseFloat($(this).next().next().text());
sum += parseFloat($(this).next().next().text());
console.log(parseFloat($(this).text()), parseFloat($(this).next().next().text()));
});
console.log(mulSum, sum, mulSum/sum);
@dbrgn
dbrgn / create_django_session.py
Last active October 31, 2022 15:20
Manually create a Django session
from django.contrib import auth
from django.contrib.sessions.backends.db import SessionStore
session = SessionStore(None)
session.clear()
session.cycle_key()
session[auth.SESSION_KEY] = user._meta.pk.value_to_string(user)
session[auth.BACKEND_SESSION_KEY] = 'django.contrib.auth.backends.ModelBackend'
session[auth.HASH_SESSION_KEY] = user.get_session_auth_hash()
session.save()
@tmilos
tmilos / README.md
Last active May 13, 2024 02:36
Modified Preorder Tree Traversal

Modified Preorder Tree Traversal

Hierarchical data metrics that allows fast read operations on tree like structures.

Based on Left and Right fields that are set during tree traversal. When entered into node value is set to it's Left, when exiting node value is set to it's Right.

Sample implementation