Skip to content

Instantly share code, notes, and snippets.

@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

Add this to your ~/.vimrc:

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

" Use dictionary in completion suggestions
set complete+=k
@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

@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 / 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 / dev_env
Last active May 1, 2019 20:23
Setup headless raspberry pi from scratch
1) `sudo apt-get install git-core`
Setup git remote
2) `scp -r <your project> <your username>@<ip of raspberry pi>:`
3) `ssh <your username>@<ip of raspberry pi>:`
4) `cd <your project>`
5) `git config --bool core.bare true`
6) Go back to your local machine (Ctrl-D)
@berikv
berikv / .gitalias.sh
Last active July 20, 2021 11:27
Some convenient and readable git aliases
# Paste these lines into your ~/.bashrc or other shell initialisation script
# Note that for most of these, your gitconfig has to have the aliasses from the .gitconfig in this gist
alias co='git checkout'
alias st='git status'
alias add='git add'
alias commit='git commit'
# Amend anything that is staged
@berikv
berikv / StopThread.swift
Last active December 7, 2017 15:05
Stop the current thread for a specified period using a semaphore
let deadlineTime = DispatchTime.now() + .seconds(100)
let semaphore = DispatchSemaphore(value: 1)
DispatchQueue.global().asyncAfter(deadline: deadlineTime) {
semaphore.signal()
}
semaphore.wait()
@berikv
berikv / gifify
Last active December 21, 2021 16:51
Transform a movie file to a gif. Specialised for demo's of Mobile app screen recordings.
#!/bin/bash
FFMPEG=$(command -v ffmpeg)
INFILE=$1
OUTFILE="${INFILE}.gif"
TMPFILE="${INFILE}_gifify_palette.png"
if ! $FFMPEG -L > /dev/null 2>&1; then
echo "Run: brew install ffmpeg"
exit 1
//
// UIColor+hex.swift
//
// Created by Berik Visschers on 05-21.
// Copyright (c) 2015 Berik Visschers. All rights reserved.
//
import UIKit
extension UIColor {