Skip to content

Instantly share code, notes, and snippets.

View tauzen's full-sized avatar

Krzysztof Mioduszewski tauzen

View GitHub Profile
@Dowwie
Dowwie / socratic_fp_learning.md
Created June 7, 2025 09:23
Following is a prompt for effective learning with an LLM. It uses the Socratic method to help the student build up their understanding from first principles. Replace the topic in the prompt and then in your follow-up prompt , specify the subject.

You are a teacher of algorithms and data-structures who specializes in the use of the socratic method of teaching concepts. You build up a foundation of understanding with your student as they advance using first principles thinking. Explain the subject that the student provides to you using this approach. By default, do not explain using source code nor artifacts until the student asks for you to do so. Furthermore, do not use analysis tools. Instead, explain concepts in natural language. You are to assume the role of teacher where the teacher asks a leading question to the student. The student thinks and responds. Engage misunderstanding until the student has sufficiently demonstrated that they've corrected their thinking. Continue until the core material of a subject is completely covered. I would benefit most from an explanation style in which you frequently pause to confirm, via asking me test questions, that I've understood your explanations so far. Particularly helpful are test questions related to sim

@joost-de-vries
joost-de-vries / recordSuspend.kt
Last active October 4, 2024 06:35
micrometer record Kotlin coroutine suspend functions
class Service(val microMeter: MicroMeterRegistry, val otherService: OtherService){
suspend fun service(id: Long){
recordAsync("theService") { otherService.getTheThing(id) }
}
private suspend fun <A> recordAsync(name: String, block: suspend () -> A): A = metricsRegistry.timer(name)
.recordSuspend(block)
}
suspend fun <A> Timer.recordSuspend(block: suspend () -> A): A =
@eribeiro
eribeiro / search_relevance_evaluation_metric.py
Last active August 21, 2022 13:20
Search relevance evaluation metrics
##
## Python implementations of the search relevance evaluation metrics described at
## https://opensourceconnections.com/blog/2020/02/28/choosing-your-search-relevance-metric/
##
##
def precision(docs):
return sum(docs) / len(docs) if docs else 0
def avg_precision(docs):
@jiahao87
jiahao87 / text_preprocessing.py
Last active July 27, 2024 14:47
Full code for preprocessing text
from bs4 import BeautifulSoup
import spacy
import unidecode
from word2number import w2n
import contractions
nlp = spacy.load('en_core_web_md')
# exclude words from spacy stopwords list
deselect_stop_words = ['no', 'not']
/**
* Educational "Free-list" memory allocator.
*
* Maintains explicit list of free memory blocks, reuses blocks on free.
* Implements "first-fit" strategy. Uses pre-allocated heap of 64 bytes,
* with 32-bit machine word size.
*
* TODO:
*
* - Implement "best-fit" strategy
@filipstachura
filipstachura / poland_woj.json
Last active February 10, 2025 13:50
GeoJSON with Polish Administrative Areas Boundaries
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bhtucker
bhtucker / upsert.py
Last active February 17, 2025 15:08
A demonstration of Postgres upserts in SQLAlchemy
"""
Upsert gist
Requires at least postgres 9.5 and sqlalchemy 1.1
Initial state:
[]
Initial upsert:
@jsdf
jsdf / ReactNativeRefreshableListView.js
Last active September 15, 2023 07:29
React Native pull down to refresh ListView
// for an updated version see https://github.com/jsdf/react-native-refreshable-listview
var React = require('react-native')
var {
ListView,
ActivityIndicatorIOS,
StyleSheet,
View,
Text,
} = React
@kamituel
kamituel / gist:38ff7a926cdd96d69076
Last active August 29, 2015 14:14
Read file from app package with extracting to the filesystem first
let app = DOMApplicationRegistry.getAppByManifestURL(manifestURL);
if (!app) {
// handle
}
let appDir = FileUtils.getDir("coreAppsDir", ["webapps", app.id], false);
let appPackage = appDir.clone();
appPackage.append("application.zip");
let zipReader = Cc["@mozilla.org/libjar/zip-reader;1"]
@kamituel
kamituel / gist:0aaf13c6f329c559476c
Created January 26, 2015 13:13
Read file from app package without extracting to the filesystem
Cu.import("resource://gre/modules/FileUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
"resource://gre/modules/NetUtil.jsm");
let app = DOMApplicationRegistry.getAppByManifestURL(manifestURL);
if (!app) {
// handle
}