Skip to content

Instantly share code, notes, and snippets.

Wojtek Lukaszuk wojteklu

Block or report user

Report or block wojteklu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wojteklu
wojteklu / SaliencyDetector.h
Created Mar 15, 2018
Generating a saliency map with the spectral residual approach
View SaliencyDetector.h
//
// Copyright © 2018 wojteklu. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SaliencyDetector: NSObject
-(CGRect)findMostProminentPartOfImage:(UIImage *)image;
-(UIImage *)selectMostProminentPartOfImage:(UIImage *)image;
View Throttler.swift
public class Throttler {
private let queue: DispatchQueue = DispatchQueue.global(qos: .background)
private var job: DispatchWorkItem = DispatchWorkItem(block: {})
private var previousRun: Date = Date.distantPast
private var maxInterval: TimeInterval
public init(maxInterval: TimeInterval) {
self.maxInterval = maxInterval
View Breakpoints_v2.xcbkptlist
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "2"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
@wojteklu
wojteklu / backtracking.swift
Created Apr 11, 2017
Solving sudoku using backtracking
View backtracking.swift
class Board: CustomStringConvertible {
var values: [Int]
let kSize = 9 // number of rows and columns
init(_ string: String) {
values = string.characters.map { Int(String($0)) ?? 0 }
}
var empty: Int? {
return values.index(of: 0)
@wojteklu
wojteklu / board.swift
Created Apr 11, 2017
Solving sudoku using constraint propagation
View board.swift
class Board {
fileprivate let kSize = 9 // number of rows and columns
fileprivate var squares: [Square]
fileprivate var units: [[[Int]]] = []
fileprivate var peers: [[Int]] = []
init(_ string: String) {
squares = [Square](repeating: Square(0b111111111), count: kSize * kSize)
for index in 0..<(kSize * kSize) {
@wojteklu
wojteklu / bayes.go
Created Feb 28, 2017
Multinomial naive Bayes classifier
View bayes.go
package bayes
// Classifier implements the Naive Bayes Classifier.
type Classifier struct {
classPerWordCount map[string]int
classPerDocument map[string]int
wordClassCount map[string]map[string]int
documentsCount int
}
@wojteklu
wojteklu / clean_code.md
Last active Aug 25, 2019
Summary of 'Clean code' by Robert C. Martin
View clean_code.md

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@wojteklu
wojteklu / terminal_notification.md
Last active Oct 2, 2016
Show macOS notification when long running command finishes and your terminal is not in focus.
View terminal_notification.md

Add the following to your ~/.zshrc:

function notifyme {
  LAST_EXIT_CODE=$?
  CMD=$(fc -ln -1)
  osascript -e 'on run argv
  tell application "System Events"
    set frontApp to name of first application process whose frontmost is true
    if frontApp is not "Terminal" then
@wojteklu
wojteklu / gitenv.md
Last active Apr 14, 2019
Perfect git environment on OS X
View gitenv.md

Perfect git environment on OS X

Global alias

Add the following to your ~/.bashrc:

alias g='git'

Branch auto-completion

You can’t perform that action at this time.