Skip to content

Instantly share code, notes, and snippets.

import ctypes as ct
def dark_title_bar(window):
"""
MORE INFO:
https://docs.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute
"""
window.update()
DWMWA_USE_IMMERSIVE_DARK_MODE = 20
set_window_attribute = ct.windll.dwmapi.DwmSetWindowAttribute
get_parent = ct.windll.user32.GetParent
@probonopd
probonopd / Wayland.md
Last active October 20, 2025 16:01
Think twice about Wayland. It breaks everything!

Think twice before abandoning X11. Wayland breaks everything!

Wayland breaks everything! It is binary incompatible, provides no clear transition path with 1:1 replacements for everything in X11, and is even philosophically incompatible with X11. Hence, if you are interested in existing applications to "just work" without the need for adjustments, then you may be better off avoiding Wayland.

Wayland solves no issues I have but breaks almost everything I need. Even the most basic, most simple things (like xkill) - in this case with no obvious replacement. And usually it stays broken, because the Wayland folks mostly seem to care about Automotive, Gnome, maybe KDE - and alienating everyone else (e.g., people using just an X11 window manager or something like GNUstep) in the process.

Feature comparison

@beardordie
beardordie / OnTriggerEnterDoStuff.cs
Created July 14, 2019 00:46
Unity - use LayerMask with collision
public LayerMask layerMask;
private void OnTriggerEnter(Collider other)
{
if (((1 << other.gameObject.layer) & layerMask) != 0)
{
// Do stuff
}
}

Latency Comparison Numbers (~2012)

Name
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cachereference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
@PiotrKrzyzek
PiotrKrzyzek / css.json
Created July 21, 2018 17:12
VSCode css snippet for standard media queries
{
"_media": {
"prefix": "_media",
"body": [
"/* Large Devices, Wide Screens */",
"@media only screen and (max-width : 1200px) {}",
"/* Medium Devices, Desktops */",
"@media only screen and (max-width : 992px) {}",
"/* Small Devices, Tablets */",
"@media only screen and (max-width : 768px) {}",
@aboucaud
aboucaud / py3k_image_downloader.py
Last active September 10, 2024 18:27
Download images from urls given in a CSV file
# !/usr/bin/python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------------------------
# Original script from @anokas: https://www.kaggle.com/anokas/py3-image-downloader-w-progress-bar
# -----------------------------------------------------------------------------------------------
# Note: requires the tqdm package (pip install tqdm)
# Note to Kagglers: This script will not run directly in Kaggle kernels. You
@Robert-IMT
Robert-IMT / [jQuery] Animated number counter
Last active November 8, 2021 21:52
jQuery animated number counter from Zero to value
$('.count').each(function () {
$(this).prop('Counter',0).animate({
Counter: $(this).text()
}, {
duration: 4000,
easing: 'swing',
step: function (now) {
$(this).text(Math.ceil(now));
}
});
@ramiabraham
ramiabraham / rom_suffix_codes.md
Last active July 3, 2025 21:23
Video game rom suffix codes (decoded)

Video game rom codes

You wouldn't download a car...


Primary rom codes

Probably what you're looking for

  • [a] Alternate (alternate version of the game, usually trying a different output method)
  • [p] Pirate
@hieblmedia
hieblmedia / .gitignore
Last active August 7, 2025 08:34
Gitignore - Exclude all except specific subdirectory
#
# If all files excluded and you will include only specific sub-directories
# the parent path must matched before.
#
/**
!/.gitignore
###############################
# Un-ignore the affected subdirectory
@rosszurowski
rosszurowski / lerp-color.js
Last active July 10, 2025 05:21
Linear interpolation for hexadecimal colors.
/**
* A linear interpolator for hexadecimal colors
* @param {String} a
* @param {String} b
* @param {Number} amount
* @example
* // returns #7F7F7F
* lerpColor('#000000', '#ffffff', 0.5)
* @returns {String}
*/