Skip to content

Instantly share code, notes, and snippets.

@berikv
berikv / setup.sh
Last active November 1, 2018 19:34
SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )"
HOMEBREW_PATH=$SCRIPT_PATH/homebrew
echo "Add $HOMEBREW_PATH/bin to PATH"
export PATH=$HOMEBREW_PATH/bin:$PATH
echo "Add $HOMEBREW_PATH/opt/binutils/bin to PATH"
export PATH=$HOMEBREW_PATH/opt/binutils/bin:$PATH
export LDFLAGS=-L$HOMEBREW_PATH/opt/binutils/lib
export CPPFLAGS=-I$HOMEBREW_PATH/opt/binutils/include
@berikv
berikv / exit.md
Last active November 10, 2018 16:34
Exit current program

Mac-os app

⌘-q

Vim

:wq

screen

ctrl-a ctrl-d (detach)
ctrl-a ctrl-\ (kill)

@berikv
berikv / download_plex.md
Created January 7, 2019 12:55
RaspberryPI Media server

Add the dev2day repository to your package source list

wget -O - https://dev2day.de/pms/dev2day-pms.gpg.key | sudo apt-key add -

Add dev2day’s repository to the package source list

echo "deb https://dev2day.de/pms/ jessie main" | sudo tee /etc/apt/sources.list.d/pms.list

Update the package list

sudo apt-get update

Download plex

Add this to your ~/.vimrc:

" Add reviewers as a dictionary
set dictionary=~/.reviewers

" Use dictionary in completion suggestions
set complete+=k
@berikv
berikv / .lldbinit
Created May 29, 2019 13:50
LLDB print description for object at memory location
expr -l objc++ -O -- (id)0x12345678
// Replace 0x12345678 with the memory location of the object
@berikv
berikv / tictactoe.swift
Last active November 11, 2022 16:16
A TicTacToe game written with SwiftUI, works in Xcode 11.0 beta Playground
import PlaygroundSupport
import SwiftUI
// MARK: - Game
extension TicTacToe.Board {
var hasNonEmptyCells: Bool {
self.flatMap { $0 }
.contains(where: { $0 != .empty })
}
@berikv
berikv / install_relative_commit
Created July 12, 2019 10:10
Installs HEAD^ as the default relative commit for arc
#!/bin/bash
#
# See: https://medium.com/@kurtisnusbaum/stacked-diffs-keeping-phabricator-diffs-small-d9964f4dcfa6
REPOSITORY_DIR=~/Work
for dir in "$REPOSITORY_DIR"/*/.git/arc/
do
echo "HEAD^" > "$dir/default-relative-commit"
done
@berikv
berikv / raspberry_headless_setup.md
Created July 25, 2019 08:01
Raspberry pi ssh headless setup
@berikv
berikv / MySQL_5-7_macOS.md
Last active April 21, 2021 12:44 — forked from robhrt7/MySQL_5-7_macOS.md
Install MySQL 5.7 on macOS using Homebrew

This is a fork of original gist https://gist.github.com/nrollr/3f57fc15ded7dddddcc4e82fe137b58e, with slight changes on pointing to 5.7 version branch, instead of 8 (latest default of MySQL in Hombrew).

Install MySQL 5.7 on macOS

This procedure explains how to install MySQL using Homebrew on macOS (Sierra 10.12 and up)

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.
@berikv
berikv / metatype.swift
Created October 16, 2021 10:23
Static member cannot be used on protocol metatype
protocol P {}
struct S: P {}
extension P {
static var a: P { S() }
}
let v = P.a
// error: static member 'a' cannot be used on protocol metatype 'P.Protocol'
// let v = P.a