Skip to content

Instantly share code, notes, and snippets.

View allisterb's full-sized avatar
🧛
Writing horrendous C++ code

Allister Beharry allisterb

🧛
Writing horrendous C++ code
View GitHub Profile
module TypeClasses
open System
let inline (|HasId|) x = (^a : (member Id : 'Id)x) // define type class
let inline getId (HasId x) = x // call type class instance
let inline (|HasShow|) x = (^a : (static member Show : ^a -> string)x) // define type class
let inline show (HasShow x) = x // call type class instance
let inline (|HasMap|) f x = (^x : (static member Map : ('a -> 'b) * ^x -> ^z) f, x) // define type class
@vszakats
vszakats / s3-upload-aws4.sh
Last active August 6, 2024 13:23
AWS S3 upload using signature v4
#!/bin/sh
# To the extent possible under law, Viktor Szakats
# has waived all copyright and related or neighboring rights to this
# script.
# CC0 - https://creativecommons.org/publicdomain/zero/1.0/
# SPDX-License-Identifier: CC0-1.0
# THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@andreazevedo
andreazevedo / install_mono.sh
Last active November 12, 2021 02:51
Install mono on centOS 6.x
$ yum install bison gettext glib2 freetype fontconfig libpng libpng-devel libX11 libX11-devel glib2-devel libgdi* libexif glibc-devel urw-fonts java unzip gcc gcc-c++ automake autoconf libtool make bzip2 wget
$ cd /usr/local/src
$ wget http://download.mono-project.com/sources/mono/mono-3.2.8.tar.bz2
$ tar jxf mono-3.2.8.tar.bz2
$ cd mono-3.2.8
module SQL
open System
open System.Data
open System.Data.SqlClient
open System.Text.RegularExpressions
open Microsoft.FSharp.Reflection
open Xunit
let connectionString = "data source=.;user id=sa;password=a;initial catalog=SomeDatabase"