Skip to content

Instantly share code, notes, and snippets.

View jcmrva's full-sized avatar

Josh M jcmrva

View GitHub Profile
@robertpi
robertpi / gist:2964793
Created June 21, 2012 09:18
F# record implementing an interface
namespace MyNamespace
type IMyInterface =
abstract GetValue: unit -> string
type MyRecord =
{ MyField1: int
MyField2: string }
interface IMyInterface with
member x.GetValue() = x.MyField2
@haf
haf / Topshelf.FSharp.fs
Last active October 11, 2017 13:23
Configure TopShelf in F#
namespace Topshelf
[<AutoOpen>]
module Topshelf =
open System
open Topshelf.HostConfigurators
open Topshelf.Runtime
let configureTopShelf f =
@ptmt
ptmt / packages.config
Last active May 21, 2017 22:58
owin self-hosted blank project in F#
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Owin" version="1.1.0-beta2" targetFramework="net45" />
<package id="Microsoft.Owin.Hosting" version="1.1.0-beta2" targetFramework="net45" />
<package id="Owin" version="1.0" targetFramework="net45" />
<package id="Owin.Extensions" version="0.8.5" targetFramework="net45" />
<package id="Owin.Types" version="0.8.5" targetFramework="net45" />
</packages>
@robotlolita
robotlolita / loops-are-evil.md
Last active March 2, 2022 17:19
Why `xs.each(f)` should not be considered a "loop".

First and foremost, let's take a look at the following pieces of code. The first one is something you should be rather familiar with, and the second one is also a somewhat familiar idiom these days (at least in languages with higher-order functions):

// Example 1:
30 + 12

// Example 2:
xs.map(f)
@swlaschin
swlaschin / ConstrainedTypesExamples.fsx
Last active July 23, 2024 10:31
Examples of creating constrained types in F#
// General hints on defining types with constraints or invariants
//
// Just as in C#, use a private constructor
// and expose "factory" methods that enforce the constraints
//
// In F#, only classes can have private constructors with public members.
//
// If you want to use the record and DU types, the whole type becomes
// private, which means that you also need to provide:
// * a constructor function ("create").
@bohdanszymanik
bohdanszymanik / wsdlServiceExample.fs
Created May 19, 2015 01:00
Example F# wsdlService typeprovider call with authentication and extra attributes (max message size)
open System
open System.ServiceModel
open Microsoft.FSharp.Linq
open Microsoft.FSharp.Data.TypeProviders
(* bit dumb but because service requests authentication, and we can't do that in the wsdlservice tp, we have to download wsdl, load it up locally, set
binding up properly, then use tp *)
open System.Net
open System.IO
open System.Text
@stevenswafford
stevenswafford / google-dorks
Created June 6, 2015 05:57
Listing of a number of useful Google dorks.
" _ _ "
" _ /|| . . ||\ _ "
" ( } \||D ' ' ' C||/ { % "
" | /\__,=_[_] ' . . ' [_]_=,__/\ |"
" |_\_ |----| |----| _/_|"
" | |/ | | | | \| |"
" | /_ | | | | _\ |"
It is all fun and games until someone gets hacked!
@alex-litvak
alex-litvak / Example.cs
Created August 12, 2015 22:11
.Net example (how to connect to Redshift)
using System;
using System.Data;
using System.Data.Odbc;
namespace your_namespace
{
class ConnectSample
{
public static void Main(string[] args)
{
<tr><td><a name="000">000</a></td><td>EmptyKey</td><td><a href="http://www.fishofprey.com/2011/06/salesforce-empty-key-id.html">Ref</a></td></tr>
<tr><td><a name="001">001</a></td><td>Account</td><td></td></tr>
<tr><td><a name="002">002</a></td><td>Note</td><td><a href="http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_note.htm">Doc</a></td></tr>
<tr><td><a name="003">003</a></td><td>Contact</td><td></td></tr>
<tr><td><a name="005">005</a></td><td>User</td><td></td></tr>
<tr><td><a name="006">006</a></td><td>Opportunity</td><td></td></tr>
<tr><td><a name="007">007</a></td><td>Activity</td><td></td></tr>
<tr><td><a name="008">008</a></td><td>OpportunityHistory</td><td></td></tr>
<tr><td><a name="00A">00A</a></td><td>FORECAST_ITEM</td><td></td></tr>
<tr><td><a name="00B">00B</a></td><td>ListView</td><td></td></tr>
@alirobe
alirobe / reclaimWindows10.ps1
Last active July 3, 2024 09:36
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### UPDATE: For Win 11, I recommend using this tool in place of this script:
### https://christitus.com/windows-tool/
### https://github.com/ChrisTitusTech/winutil
### https://www.youtube.com/watch?v=6UQZ5oQg8XA
### iwr -useb https://christitus.com/win | iex
###
###