Skip to content

Instantly share code, notes, and snippets.

View cloudcalvin's full-sized avatar

Calvin M cloudcalvin

  • Stellenbosch South Africa
View GitHub Profile
@cloudcalvin
cloudcalvin / keybase.md
Created August 13, 2020 11:00
Keybase Identity

Keybase proof

I hereby claim:

  • I am cloudcalvin on github.
  • I am cloudcalvin (https://keybase.io/cloudcalvin) on keybase.
  • I have a public key ASAeHvahJvgKwlbfYosEqjHYkCNGkibhg7pUfZeQwbvmkgo

To claim this, I am signing this object:

# == Introduction
#
# Unit testing is making waves all over the place, largely due to the
# fact that it is a core practice of XP. While XP is great, unit testing
# has been around for a long time and has always been a good idea. One
# of the keys to good unit testing, though, is not just writing tests,
# but having tests. What's the difference? Well, if you just _write_ a
# test and throw it away, you have no guarantee that something won't
# change later which breaks your code. If, on the other hand, you _have_
# tests (obviously you have to write them first), and run them as often
Similarly named abstract types must conform when mixed together:
scala> trait Foo { type T }
defined trait Foo
scala> trait Bar { type T }
defined trait Bar
scala> trait FooBar { this: Foo with Bar => }
defined trait FooBar
@cloudcalvin
cloudcalvin / ASS.md
Created March 20, 2018 12:32 — forked from klaaspieter/ASS.md
Acronyms Seriously Suck - Elon Musk

From time to time, Musk will send out an e-mail to the entire company to enforce a new policy or let them know about something that's bothering him. One of the more famous e-mails arrived in May 2010 with the subject line: Acronyms Seriously Suck:

There is a creeping tendency to use made up acronyms at SpaceX. Excessive use of made up acronyms is a significant impediment to communication and keeping communication good as we grow is incredibly important. Individually, a few acronyms here and there may not seem so bad, but if a thousand people are making these up, over time the result will be a huge glossary that we have to issue to new employees. No one can actually remember all these acronyms and people don't want to seem dumb in a meeting, so they just sit there in ignorance. This is particularly tough on new employees.

That needs to stop immediately or I will take drastic action - I have given enough warning over the years. Unless an acronym is approved by me, it should not enter the SpaceX glossary.

@cloudcalvin
cloudcalvin / curl-crawler.sh
Created February 3, 2018 16:58 — forked from oliveratgithub/curl-crawler.sh
Unix Shell-Script to crawl a list of website URLs using curl
#!/bin/sh
timezone="Europe/Zurich"
# List of valid timezones: wikipedia.org/wiki/List_of_tz_database_time_zones
script="${0##*/}"
rootdir=$(cd `dirname "${BASH_SOURCE[0]}"` && pwd)
logfile="$script.log"
log="$rootdir/$logfile"
now=$(TZ=":$timezone" date)
# Uncomment 'mailto=' (remove #) to enable emailing the log upon completion
#mailto="your@email.com"
@cloudcalvin
cloudcalvin / .tmux.conf
Created November 2, 2016 11:52 — forked from joonty/.tmux.conf
My tmux config
set -g history-limit 5000
set-window-option -g utf8 on # utf8 support
# Open man page in new window
bind / command-prompt "split-window 'exec man %%'"
bind y run-shell "tmux show-buffer | xclip -sel clip -i" \; display-message "Copied tmux buffer to system clipboard"
set -g update-environment -r
# quick view of processes
bind '~' split-window "exec htop"
@cloudcalvin
cloudcalvin / Makefile
Created April 16, 2016 14:59 — forked from timcharper/Makefile
multirust source downloader
# Save this file to ~/.multirust/Makefile
# to run, cd ~/.multirust; make toolchains/1.3.0/src
.PHONY: clean
rust.git:
git clone https://github.com/rust-lang/rust.git --bare
toolchains/nightly/src: toolchains/master/src
ln -sf $$(pwd)/toolchains/master/src $$(pwd)/$@

#Create bitbucket branch

##Create local branch

$ git checkout -b sync
Switched to a new branch 'sync'
$ git branch
  master
* sync

Rust/Haskell: Higher-Kinded Types (HKT)

A higher kinded type is a concept that reifies a type constructor as an actual type.

A type constructor can be thought of in these analogies:

  • like a function in the type universe
  • as a type with a "hole" in it
@cloudcalvin
cloudcalvin / ObjToPolyhedron.cpp
Created August 25, 2015 20:58
CGAL::Polyhedron_incremental_builder_3<HDS> used to build triangulated polyhedron from OBJ/OFF file
//
// sourced from "http://jamesgregson.blogspot.com/2012/05/example-code-for-building.html"
//
#include<fstream>
#include<vector>
#include<string>
#include<algorithm>
#include<CGAL/Simple_cartesian.h>
#include<CGAL/Polyhedron_incremental_builder_3.h>