Skip to content

Instantly share code, notes, and snippets.

View g00dm0us3's full-sized avatar
๐Ÿ™ˆ

Dmitry g00dm0us3

๐Ÿ™ˆ
View GitHub Profile
@g00dm0us3
g00dm0us3 / grokking_to_leetcode.md
Created February 1, 2025 13:30 — forked from tykurtz/grokking_to_leetcode.md
Grokking the coding interview equivalent leetcode problems

GROKKING NOTES

I liked the way Grokking the coding interview organized problems into learnable patterns. However, the course is expensive and the majority of the time the problems are copy-pasted from leetcode. As the explanations on leetcode are usually just as good, the course really boils down to being a glorified curated list of leetcode problems.

So below I made a list of leetcode problems that are as close to grokking problems as possible.

Pattern: Sliding Window

@g00dm0us3
g00dm0us3 / UIScrollViewZoomAdjustmentExample.swift
Created March 9, 2024 12:19
Adjusting UIScrollView's contentOffset on zoom, so that zoomed position remains fixed.
func updateContentOffset(
newContentViewBounds: CGRect,
oldContentViewBounds: CGRect
) {
guard oldContentViewBounds.size != .zero else { return }
// Increment of x / y.
let dx = newContentViewBounds.width - oldContentViewBounds.width
let dy = newContentViewBounds.height - oldContentViewBounds.height
@g00dm0us3
g00dm0us3 / config
Created December 26, 2023 12:46 — forked from rbialek/config
ssh/.config
Host github.com
User git
Hostname github.com
PreferredAuthentications publickey
IdentityFile /home/user/.ssh/id_rsa
@g00dm0us3
g00dm0us3 / vmmap.c
Created May 6, 2023 10:40 — forked from bazad/vmmap.c
A simple vmmap implementation for macOS.
// Brandon Azad (@_bazad)
#include <assert.h>
#include <errno.h>
#include <mach/mach.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@g00dm0us3
g00dm0us3 / float16.c
Created April 25, 2023 10:56 — forked from neshume/float16.c
Fast half-precision to single-precision floating point conversion
// float32
// Martin Kallman
//
// Fast half-precision to single-precision floating point conversion
// - Supports signed zero and denormals-as-zero (DAZ)
// - Does not support infinities or NaN
// - Few, partially pipelinable, non-branching instructions,
// - Core opreations ~6 clock cycles on modern x86-64
void float32(float* __restrict out, const uint16_t in) {
uint32_t t1;
@g00dm0us3
g00dm0us3 / extensions.json
Created April 12, 2023 15:24 — forked from GavinRay97/extensions.json
VS Code "clangd" base config, with: CMake Tools extension, MS C/C++ extension (debugging), vcpkg integration
{
"recommendations": [
"twxs.cmake",
"ms-vscode.cpptools",
"ms-vscode.cmake-tools",
"llvm-vs-code-extensions.vscode-clangd"
]
}
@g00dm0us3
g00dm0us3 / yuv2rgb.mm
Created April 26, 2022 03:45 — forked from shalyf/yuv2rgb.mm
create rgb image from yuv color space
#define clamp(a) (a>255?255:(a<0?0:a))
+ (UIImage *)imageFromSampleBuffer:(CMSampleBufferRef)sampleBuffer {
CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);
CVPixelBufferLockBaseAddress(imageBuffer, 0);
if (CVPixelBufferGetPlaneCount(imageBuffer) < 2) {
CVPixelBufferUnlockBaseAddress(imageBuffer, 0);
return nil;
}
@g00dm0us3
g00dm0us3 / UIColor+Utils.swift
Created April 17, 2022 06:03
UIColor from hex code
extension UIColor {
convenience init(hexCode: UInt32, alpha: CGFloat = 1) {
let r = CGFloat((hexCode & 0xff0000) >> 16) / 255.0
let g = CGFloat((hexCode & 0x00ff00) >> 8) / 255.0
let b = CGFloat(hexCode & 0xff) / 255.0
self.init(red: r, green: g, blue: b, alpha: alpha)
}
}
@g00dm0us3
g00dm0us3 / Fonts.swift
Created January 20, 2021 06:02 — forked from khanlou/Fonts.swift
Print all fonts in Swift 3
UIFont.familyNames.forEach({ familyName in
let fontNames = UIFont.fontNames(forFamilyName: familyName)
print(familyName, fontNames)
})
@g00dm0us3
g00dm0us3 / Fonts.swift
Created January 20, 2021 06:02 — forked from khanlou/Fonts.swift
Print all fonts in Swift 3
UIFont.familyNames.forEach({ familyName in
let fontNames = UIFont.fontNames(forFamilyName: familyName)
print(familyName, fontNames)
})