Skip to content

Instantly share code, notes, and snippets.

@vdt
vdt / New Mac Setup.org
Created January 12, 2016 06:08 — forked from stig/New Mac Setup.org
SETUP of new machine

How I set up a new Mac

Install Apps

First I install some apps. I try to use the AppStore for everything if I can, buth unfortunately that’s not possible. YMMV.

AppStore

@vdt
vdt / math-and-simple-call-in-core-logic.clj
Created January 16, 2016 18:21 — forked from piotr-yuxuan/math-and-simple-call-in-core-logic.clj
Learning try-and-diy: how can I simplify this example?
(ns firstshot.chessknightmove
(:refer-clojure :exclude [== >= <= > < =])
(:use clojure.core.logic
clojure.core.logic.arithmetic))
(defn knight-moves
"Returns the available moves for a knight (on a 8x8 grid) given its current position."
[x y]
(let [xmax 8 ymax 8]
(run* [q]
@vdt
vdt / icerm.md
Created January 30, 2016 17:04 — forked from chrishwiggins/icerm.md
@vdt
vdt / pagination.md
Created February 2, 2016 06:03 — forked from mislav/pagination.md
"Pagination 101" by Faruk Ateş

Pagination 101

Article by Faruk Ateş, [originally on KuraFire.net][original] which is currently down

One of the most commonly overlooked and under-refined elements of a website is its pagination controls. In many cases, these are treated as an afterthought. I rarely come across a website that has decent pagination, and it always makes me wonder why so few manage to get it right. After all, I'd say that pagination is pretty easy to get right. Alas, that doesn't seem the case, so after encouragement from Chris Messina on Flickr I decided to write my Pagination 101, hopefully it'll give you some clues as to what makes good pagination.

Before going into analyzing good and bad pagination, I want to explain just what I consider to be pagination: Pagination is any kind of control system that lets the user browse through pages of search results, archives, or any other kind of continued content. Search results are the o

@vdt
vdt / gist:d724fe49818069bd0305
Created February 16, 2016 09:51 — forked from Bemmu/gist:da5c79e9027bd3e248b7
BigQuery for most popular countries on Hacker News
SELECT
b.country,
SUM(score) as total_score,
SUM(a.c) as mention_count,
ROUND(SUM(score) / SUM(a.c), 2) as avg_score
FROM
(
SELECT
a.word,
SUM(a.score) AS score,
@vdt
vdt / links.md
Created June 14, 2016 14:13 — forked from MarkVillacampa/links.md
All the Apple Developer links you need from WWDC16
"""Count words."""
def count_words(s, n):
"""Return the n most frequently occuring words in s."""
# TODO: Count the number of occurences of each word in s
words = s.split(" ")
# set comprehension so we only have unique values
word_frequencies = {word: words.count(word) for word in words}
word_frequency_tuples = [(word, count) for word, count in word_frequencies.items()]
@vdt
vdt / .bash_profile
Created November 22, 2016 16:36 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@vdt
vdt / gist:13e4aaac332b1f7c5e82087b8550c4ad
Created November 23, 2016 16:53 — forked from stilist/gist:cd7fdfabbf9ec5ed89b7
Installing OpenCV on OS X (using Homebrew)

Based on http://jjyap.wordpress.com/2014/02/21/installing-opencv-2-4-8-on-mac-osx-with-python-support/

  1. edit .bashrc or .bash_profile to include: export PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:/Library/Python/2.7/site-packages/:$PATH"
  2. brew update
  3. brew tap homebrew/science
  4. brew install opencv
  5. cd /Library/Python/2.7/site-packages/
  6. ln -s /usr/local/Cellar/opencv/2.4.9/lib/python2.7/site-packages/cv.py cv.py
  7. ln -s /usr/local/Cellar/opencv/2.4.9/lib/python2.7/site-packages/cv2.so cv2.so
@vdt
vdt / install_opencv_on_mac.md
Created November 23, 2016 16:54 — forked from ldong/install_opencv_on_mac.md
install opencv on mac
  1. Create a virtualenv, mkvirtualenv lookup

  2. install opencv on mac via homebrew

brew tap homebrew/science
brew install opencv
cd ~/.virtualenvs/lookup/lib/python2.7/site-packages
ln -s /usr/local/Cellar/opencv/{VERSION_NUMBER}/lib/python2.7/site-packages/cv.py cv.py
ln -s /usr/local/Cellar/opencv/{VERSION_NUMBER}/lib/python2.7/site-packages/cv2.so cv2.so