Skip to content

Instantly share code, notes, and snippets.

OnorioCatenacci / TicTacToeGame.tla
Created Nov 3, 2020
Initial state of TicTacToe Game
View TicTacToeGame.tla
--------------------------- MODULE TicTacToeGame ---------------------------
VARIABLE boardPositions, turn
tokens == {"X","O","V","-"} (* V == "Vacant", - == "Doesn't matter" *)
row == <<tokens, tokens, tokens>>
grid == <<row, row, row>>
col_1_Win(token) == <<
<<token, "-", "-">>,
<<token, "-", "-">>,
<<token, "-", "-">>
View TwoDtUtil.ex
#Two small, quick date utility functions. Convert a wxDateTime (from wxErlang) to a YYYYMMDD string. NB: assumes year is post 1000 CE.
defp wxDatetime_to_string({{year,month,day},{_hour,_minute,_second}}), do: "#{year}#{zero_padding(month,2)}#{zero_padding(day,2)}"
#Pad a string out with a specified number of leading zeroes.
defp zero_padding(string,len), do: String.rjust(to_string(string), len, ?0)
View SpeakerResources
Good Fonts:
Font Squirrel:
Urban Fonts:
Google Web Fonts:
Color Schemes:
Colour Lovers:
Color Scheme Designer:
Image Color Picker:
OnorioCatenacci / WinClip.ex
Created Aug 1, 2014
How To Write Data To Windows Clipboard
View WinClip.ex
defmodule WinClip do
def write_to_clipboard(string_to_write) do
p ={:spawn,"clip"},[:stderr_to_stdout, :stream, :binary, :exit_status])
OnorioCatenacci / stack.ex
Last active Aug 29, 2015
A Naive Implementation Of A Stack
View stack.ex
defmodule Stack do
defstruct name: "", value: 0
def init() do
_s = []
def push(name, value, s) do
s_new = [%Stack{name: name, value: value}, s]
OnorioCatenacci / LiteralWithFormatString.fs
Created Oct 10, 2013
Trying to use [<Literal>] with Format String
View LiteralWithFormatString.fs
let formatString = "format of %s"
let s = sprintf formatString "test"
OnorioCatenacci / fortunecookie.fsx
Created Oct 10, 2013
Connect F# To Access Via Odbc
View fortunecookie.fsx
open System
open System.Data.Odbc
open System.Windows.Forms
let connectToAccess filename =
let connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;FileDSN=" + filename + ";User Id=admin;Password=;"
new OdbcConnection(connectionString)
let connectToDb() =
OnorioCatenacci / DigitScript.fsx
Last active Dec 21, 2015
Machine Learning Dojo
View DigitScript.fsx
// This F# dojo is directly inspired by the
// Digit Recognizer competition from
// The datasets below are simply shorter versions of
// the training dataset from Kaggle.
// The goal of the dojo will be to
// create a classifier that uses training data
// to recognize hand-written digits, and
// evaluate the quality of our classifier
OnorioCatenacci / CheckForConn.fs
Last active Dec 18, 2015
F# Code To Check For Connection Type With Xamarin.Android
View CheckForConn.fs
open Android.App
open Android.Content
open Android.Net
let IsConnectionAvailable (app:Activity) connTypeToCheckFor =
let n = app.GetSystemService(Context.ConnectivityService)
let cm =
match n with
OnorioCatenacci / githelpers.ps1
Created Apr 8, 2013
Everyday Git Aliases For Powershell (Github For Windows)
View githelpers.ps1
#Adjust these values for your own installation.
Set-Variable -Name defaultDirectory -option Readonly -value "c:/mydev"
Set-Variable -Name defaultRepository -option Readonly -value "myrepo"
Set-Variable -Name defaultBranch -option Readonly -value "workbranch"
#Per "Everyday git-aliases", do a rebase as opposed to a merge
function gpurr($repository=$defaultRepository, $branch=$defaultBranch)
& 'git' pull --rebase $repository $branch