Skip to content

Instantly share code, notes, and snippets.

@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)"
@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).
@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.")
)
@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
}
@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
@ruslangabitov
ruslangabitov / go-tls-renegotiation patch
Created December 1, 2014 23:41
go-tls-renegotiation patch
diff -r c242bbf5fa8c src/pkg/crypto/tls/common.go
--- a/src/pkg/crypto/tls/common.go Wed Jul 17 14:03:27 2013 -0400
+++ b/src/pkg/crypto/tls/common.go Thu Jul 18 13:45:43 2013 -0400
@@ -44,6 +44,7 @@
// TLS handshake message types.
const (
+ typeHelloRequest uint8 = 0
typeClientHello uint8 = 1
typeServerHello uint8 = 2
@mpasternacki
mpasternacki / freebsd_on_mbp.md
Created January 23, 2015 17:12
FreeBSD on a MacBook Pro

FreeBSD on a MacBook Pro

Since 2008 or 2009 I work on Apple hardware and OS: back then I grew tired of Linux desktop (which is going to be MASSIVE NEXT YEAR, at least since 2001), and switched to something that Just Works. Six years later, it less and less Just Works, started turning into spyware and nagware, and doesn't need much less maintenance than Linux desktop — at least for my work, which is system administration and software development, probably it is better for the mythical End User person. Work needed to get software I need running is not less obscure than work I'd need to do on Linux or othe Unix-like system. I am finding myself turning away from GUI programs that I used to appreciate, and most of the time I use OSX to just run a terminal, Firefox, and Emacs. GUI that used to be nice and unintrusive, got annoying. Either I came full circle in the last 15 years of my computer usage, or the OSX experience degraded in last 5 years. Again, this is from a sysadmin/developer ki

@mbainter
mbainter / aws_config.fish
Last active February 24, 2024 15:51
Fish shell function to set your AWS credentials with MFA for use with Terraform
function aws_config
if not fgrep -q "[$argv]" ~/.aws/credentials
echo "Please specify a valid profile."
else
set -e AWS_ACCESS_KEY
set -e AWS_SECRET_KEY
set -g -x ATLAS_TOKEN (awk "/\[$argv\]/,/^\$/ { if (\$1 == \"atlas_token\") { print \$3 }}" ~/.aws/credentials)
set account (awk "/\[$argv\]/,/^\$/ { if (\$1 == \"account_id\") { print \$3 }}" ~/.aws/credentials)
set username (awk "/\[$argv\]/,/^\$/ { if (\$1 == \"username\") { print \$3 }}" ~/.aws/credentials)
set mfarn "arn:aws:iam::$account:mfa/$username"
@ericlagergren
ericlagergren / index.gohtml
Last active December 22, 2023 17:51
Hot-reloading / hot-swapping live template files in Go
My name is {{.Name}} and I'm {{.Age}} years old!!
#!/bin/bash
set -e
# Send a private message to someone on slack
# from the command line.
# Print a usage message and exit.
usage(){
local name=$(basename "$0")