Skip to content

Instantly share code, notes, and snippets.

@thinkbeforecoding
thinkbeforecoding / FsCluster.fs
Created May 20, 2014 12:14
EventStore cluster in a F# script !
(*
This gist runs a 3 in memory node EventStore cluster
and a client that send messages to the cluster
To use the web interface, copy EventStore web folders.
You can found them in the server distribution at http://geteventstore.com/downloads/.
Then connect to http://localhost:2113/
You can view the cluster status at:
http://localhost:2113/web/gossip.htm
@eulerfx
eulerfx / EvetStore.fs
Last active February 20, 2016 13:07
EventStore pull-to-push subscription transition
let subscribeAsAsyncSeq (conn:IEventStoreConnection) (stream:string) (resolveLinks:bool) (bufferSize:int) (ct:CancellationToken) = asyncSeq {
use buffer = new System.Collections.Concurrent.BlockingCollection<ResolvedEvent>(bufferSize)
let inline onEvent subs (evt:ResolvedEvent) =
buffer.Add(evt)
let inline onDrop (subs:EventStoreSubscription) (reason:SubscriptionDropReason) (ex:exn) =
printfn "SUBSCRIPTION DROPPED! last position=%i reason=%O ex=%O" (subs.LastEventNumber.GetValueOrDefault()) reason ex
()
let! subs = conn.SubscribeToStreamAsync(stream, resolveLinks, Action<_,_>(onEvent), Action<_,_,_>(onDrop), null) |> Async.AwaitTask
yield! buffer.GetConsumingEnumerable(ct) |> AsyncSeq.ofSeq
}
@damianh
damianh / Rename-Project.psm1
Last active May 25, 2018 23:10
Renames a csproj - Project Name, DirectoryName, AssemblyName and references to the project
# Works for me. You may need to tweak it. Stick it in your powershell profile FTW
function Rename-Project
{
# designed to run from the solution directory where the project is a child directory
param(
[string]$projectName=$(throw "projectName required."),
[string]$newProjectName=$(throw "newProjectName required.")
)
@praeclarum
praeclarum / SingleThreaded.cs
Created January 25, 2014 23:36
Use single threaded blocking code from your UI
using System;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Concurrent;
namespace Praeclarum
{
/// <summary>
/// Wraps a value and only allows access to it using a single thread
/// of execution (see SingleThreadQueue).
@t-io
t-io / osx_install.sh
Last active October 22, 2023 13:04
Install most of my Apps with homebrew & cask
#!/bin/sh
echo Install all AppStore Apps at first!
# no solution to automate AppStore installs
read -p "Press any key to continue... " -n1 -s
echo '\n'
echo Install and Set San Francisco as System Font
ruby -e "$(curl -fsSL https://raw.github.com/wellsriley/YosemiteSanFranciscoFont/master/install)"
echo Install Homebrew, Postgres, wget and cask
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@jyap808
jyap808 / decrypt_gpg_armor.go
Created January 4, 2014 01:05
Decrypting an ASCII armored GPG encrypted string in Golang
package main
import (
"bytes"
"code.google.com/p/go.crypto/openpgp"
"code.google.com/p/go.crypto/openpgp/armor"
"fmt"
"io/ioutil"
"log"
)
@anaisbetts
anaisbetts / gh_unsub.rb
Last active December 25, 2015 18:09
Unsubscribe from all repos that you have not contributed to
#!/usr/bin/env ruby
require 'octokit'
pass_re = /^password: "(.*)"$/
token = `security find-generic-password -s "GitHub API Token" -g 2>&1 | grep "password"`.match(pass_re)[1]
c = Octokit::Client.new(:access_token => token)
user_login = c.user.login
@AlainODea
AlainODea / hello.c
Last active March 16, 2016 09:00
Cross-compiler from x86_64 Linux to x86_64 Illumos on Ubuntu (works for Hello World and possibly more)
#include<stdio.h>
main()
{
printf("Hello World");
}
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active May 4, 2024 21:33
A badass list of frontend development resources I collected over time.
@sgrankin
sgrankin / macvim.rb
Created February 6, 2013 00:55
Hombrew's macvim formula using brew-installed python and ruby
require 'formula'
class Macvim < Formula
homepage 'http://code.google.com/p/macvim/'
url 'https://github.com/b4winckler/macvim/tarball/snapshot-66'
version '7.3-66'
sha1 'd11696f7089688fa96a45fc57410c60f6ca5a394'
head 'https://github.com/b4winckler/macvim.git', :branch => 'master'