Skip to content

Instantly share code, notes, and snippets.

View kyzmitch's full-sized avatar

Andrei Ermoshin kyzmitch

  • Russia, Nizhny Novgorod
View GitHub Profile
@kyzmitch
kyzmitch / enum_with_raw_string.hpp
Created September 12, 2023 19:52
c++ meta programming example
#include <optional>
#include <string>
#include <type_traits>
/**
@tparam T must be an Enum type.
@tparam C converter must have `toString` and `fromString` static methods
*/
template<typename T,
typename C,
@RuolinZheng08
RuolinZheng08 / backtracking_template.py
Last active June 6, 2024 22:47
[Algo] Backtracking Template & N-Queens Solution
def is_valid_state(state):
# check if it is a valid solution
return True
def get_candidates(state):
return []
def search(state, solutions):
if is_valid_state(state):
solutions.append(state.copy())
@neilsmithdesign
neilsmithdesign / swift-ui-protocol-view-models.swift
Last active June 18, 2024 15:24
SwiftUI views with protocol interfaces to view models.
import SwiftUI
/// View model protocol
protocol ViewModel: ObservableObject {
var count: Int { get }
func increase()
}
/// Concrete implementation
class MyViewModel: ViewModel {
@lattner
lattner / TaskConcurrencyManifesto.md
Last active July 24, 2024 08:37
Swift Concurrency Manifesto
@mido3ds
mido3ds / Base.hpp
Last active July 2, 2024 14:05
template inheritance in c++
template<typename T>
class Base
{
public:
T someVariable;
};
@kharrison
kharrison / CoreDataController.swift
Last active January 31, 2023 22:36
Swift wrapper for NSPersistentContainer - Easy Core Data Setup with iOS 10
//
// CoreDataController.swift
//
// Created by Keith Harrison http://useyourloaf.com
// Copyright (c) 2017 Keith Harrison. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright
@steipete
steipete / SpinlockTestTests.swift
Last active August 29, 2023 08:47 — forked from RomanTruba/Synchronization_test_iOS_SDK10
Updated for Xcode 8, Swift 3; added os_unfair_lock
//
// SpinlockTestTests.swift
// SpinlockTestTests
//
// Created by Peter Steinberger on 04/10/2016.
// Copyright © 2016 PSPDFKit GmbH. All rights reserved.
//
import XCTest
@CTurt
CTurt / gist:27fe7f3c241f69be19e5
Created December 14, 2015 19:24
PS4 kernel exploit tease (root FS dump, and list of PIDs)
[+] Entered shellcode
[+] UID: 0, GID: 0
[DIR]: .
[DIR]: ..
[DIR]: adm
[DIR]: app_tmp
[DIR]: data
[DIR]: dev
[DIR]: eap_user
[DIR]: eap_vsh
@nlutsenko
nlutsenko / yolo.sh
Last active July 22, 2024 05:12
Fast Xcode builds
defaults write xcodebuild PBXNumberOfParallelBuildSubtasks 4
defaults write xcodebuild IDEBuildOperationMaxNumberOfConcurrentCompileTasks 4
defaults write com.apple.xcode PBXNumberOfParallelBuildSubtasks 4
defaults write com.apple.xcode IDEBuildOperationMaxNumberOfConcurrentCompileTasks 4
@l1x
l1x / install_gradle_version_with_homebrew.sh
Created June 17, 2015 19:24
Installing a specific version of Gradle with Homebrew
brew tap homebrew/versions
brew search gradle
brew install homebrew/versions/gradle112
gradle -version
brew link --overwrite gradle112
gradle -version