Skip to content

Instantly share code, notes, and snippets.

@thinktainer
thinktainer / init.yml
Last active August 29, 2015 14:08 — forked from renoirb/init.yml
#
# How to install automatically Oracle Java 7 under Salt Stack
#
# Thanks Oracle for complicating things :(
#
# 1. Create a java/ folder in your salt master
# 2. Paste this file in init.sls
# 3. salt '*' state.sls java
#
# Source:
@thinktainer
thinktainer / introrx.md
Last active August 29, 2015 14:08 — forked from staltz/introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

@thinktainer
thinktainer / getPropertyName.fsx
Created November 12, 2014 12:12
getPropertyName
open Microsoft.FSharp.Quotations.Patterns
let rec propertyName quotation =
match quotation with
| PropertyGet (_,propertyInfo,_) -> propertyInfo.Name
| Lambda (_,expr) -> propertyName expr
| _ -> ""
let myPropertyName = propertyName <@ fun (x : myClass) -> x.MyProperty @>
@thinktainer
thinktainer / .bash_profile
Created January 22, 2015 10:43
ssh-agent bash_profile
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add;
}
@thinktainer
thinktainer / show-networks.sh
Created February 2, 2015 09:27
vmware networks file
cat /Library/Preferences/VMware\ Fusion/networking
@thinktainer
thinktainer / obs.fs
Created February 4, 2015 16:54
Create an observable from an IEvent
Observable.createWithDisposable (fun observer -> Observable.subscribeObserver observer eventAggregate)
F:\perfview\perfview.exe -ClrEvents="default-stack-GCHeapSurvivalAndMovement" -StopOnGCOverMSec:500 -DelayAfterTriggerSec:0 -CircularMB:3000 -CollectMultiple:3 -NoGUI -NoNGENRundown -AcceptEULA -ThreadTime -DumpHeap -Process="Bede.Wallet.ServiceHost" collect
@thinktainer
thinktainer / Vagrantfile
Created April 9, 2015 18:02
vagrant docker host
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Specify Vagrant version and Vagrant API version
Vagrant.require_version ">= 1.6.0"
VAGRANTFILE_API_VERSION = "2"
# Create and configure the VM(s)
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
@thinktainer
thinktainer / errorcede.cs
Created April 17, 2015 10:21
get win error code from HRESULT
var errorCode = Marshal.GetHRForException(ex) & ((1 << 16) - 1);