Skip to content

Instantly share code, notes, and snippets.

View serpent7776's full-sized avatar
🤔

Krzysztof Leśniak serpent7776

🤔
View GitHub Profile
@serpent7776
serpent7776 / lockstat.py
Last active April 10, 2024 15:21 — forked from SaveTheRbtz/lockstat.py
eBPF-based lock profiling tool inspired by lockstat(1M)
#!/usr/bin/env python
"""
The MIT License (MIT)
Copyright (c) 2017 Sasha Goldshtein
Copyright (c) 2018 Alexey Ivanov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@serpent7776
serpent7776 / effective_modern_cmake.md
Last active November 3, 2020 10:39 — forked from mbinna/effective_modern_cmake.md
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

@serpent7776
serpent7776 / pointsPixels.m
Last active March 18, 2018 13:15
iOS - Points to pixels and Pixels to points conversion
- (CGFloat)pixelToPoints:(CGFloat)px {
CGFloat pointsPerInch = 72.0; // see: http://en.wikipedia.org/wiki/Point%5Fsize#Current%5FDTP%5Fpoint%5Fsystem
CGFloat scale = 1;
float pixelPerInch; // DPI
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
pixelPerInch = 132 * scale;
} else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
pixelPerInch = 163 * scale;
} else {
pixelPerInch = 160 * scale;
@serpent7776
serpent7776 / circular_buffer.lua
Last active June 11, 2021 23:10 — forked from johndgiese/circular_buffer.lua
Circular Buffer in Lua
-- circular buffer factory for lua
local function rotate_indice(i, n)
return ((i - 1) % n) + 1
end
local circular_buffer = {}
function circular_buffer:filled()
return #(self.history) == self.max_length