Skip to content

Instantly share code, notes, and snippets.

View denizetkar's full-sized avatar
🏢
I may be slow to respond.

Deniz Etkar denizetkar

🏢
I may be slow to respond.
  • TNG Technology Consulting GmbH
  • Munich, Germany
View GitHub Profile
@barend
barend / logging.py
Created October 26, 2020 09:44
Configure Python logging with ISO-8601 format and UTC time
import logging
from time import gmtime
# https://stackoverflow.com/a/7517430/49489
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s.%(msecs)03dZ [%(name)s] %(message)s",
datefmt="%Y-%m-%dT%H:%M:%S",
)
logging.Formatter.converter = gmtime
@Berny23
Berny23 / tw3facts.txt
Created September 13, 2020 19:24
The Witcher 3 - Facts (Mirror)
The Witcher 3 - Facts
Source: http://www.vertigofx.com/public/games/tw3/tw3facts.txt
== dlc/bob/data/gameplay/community/dialogues/chats/chat_beauclair_citizens_01.w2scene:
lw_ww_geralt_of_rivia_wine
== dlc/bob/data/gameplay/community/dialogues/chats/chat_beauclair_citizens_02.w2scene:
mq7015_done
@tylerneylon
tylerneylon / rwlock.py
Last active January 15, 2025 00:16
A simple read-write lock implementation in Python.
# -*- coding: utf-8 -*-
""" rwlock.py
A class to implement read-write locks on top of the standard threading
library.
This is implemented with two mutexes (threading.Lock instances) as per this
wikipedia pseudocode:
https://en.wikipedia.org/wiki/Readers%E2%80%93writer_lock#Using_two_mutexes
@jeremyjordan
jeremyjordan / soft_dice_loss.py
Last active September 20, 2023 12:50
Generic calculation of the soft Dice loss used as the objective function in image segmentation tasks.
def soft_dice_loss(y_true, y_pred, epsilon=1e-6):
'''
Soft dice loss calculation for arbitrary batch size, number of classes, and number of spatial dimensions.
Assumes the `channels_last` format.
# Arguments
y_true: b x X x Y( x Z...) x c One hot encoding of ground truth
y_pred: b x X x Y( x Z...) x c Network output, must sum to 1 over c channel (such as after softmax)
epsilon: Used for numerical stability to avoid divide by zero errors
@mbinna
mbinna / effective_modern_cmake.md
Last active November 11, 2025 13:40
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@SKempin
SKempin / Git Subtree basics.md
Last active November 10, 2025 21:03
Git Subtree basics

Git Subtree Basics

If you hate git submodule, then you may want to give git subtree a try.

Background

When you want to use a subtree, you add the subtree to an existing repository where the subtree is a reference to another repository url and branch/tag. This add command adds all the code and files into the main repository locally; it's not just a reference to a remote repo.

When you stage and commit files for the main repo, it will add all of the remote files in the same operation. The subtree checkout will pull all the files in one pass, so there is no need to try and connect to another repo to get the portion of subtree files, because they were already included in the main repo.

Adding a subtree

Let's say you already have a git repository with at least one commit. You can add another repository into this respository like this:

@julie-is-late
julie-is-late / rsa_loading.go
Created February 21, 2017 23:37
How to load rsa keys in go
package config
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"io/ioutil"
"github.com/CodeCollaborate/Server/utils"
@higebu
higebu / connect_with_specific_source_port.go
Created May 16, 2016 03:48
Golang: Connect with specific source port
package main
import (
"bufio"
"fmt"
"log"
"net"
)
func main() {
@vmonaco
vmonaco / runs_test.py
Last active February 1, 2024 04:32
Multivariate Wald-Wolfowitz test to compare the distributions of two samples
"""
Multivariate Wald-Wolfowitz test for two samples in separate CSV files.
See:
Friedman, Jerome H., and Lawrence C. Rafsky.
"Multivariate generalizations of the Wald-Wolfowitz and Smirnov two-sample tests."
The Annals of Statistics (1979): 697-717.
Given multivariate sample X of length m and sample Y of length n, test the null hypothesis: