Skip to content

Instantly share code, notes, and snippets.

View dstcruz's full-sized avatar

Daniel Santa Cruz dstcruz

  • S&P Global
  • Denver, CO
View GitHub Profile
@dstcruz
dstcruz / gist:da1968b2a8c0dbc6a9d4cababeb8c832
Created October 24, 2024 19:23
Powershell PSReadlLine keybinding for C-e to go to the end of the line if we are not there, or accept the autosuggestion if we are there
​Set-PsReadlineKeyHandler -Chord 'Ctrl+e' -ScriptBlock {
$line = $cursor = $null
[Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref] $line, [ref] $cursor)
if ($cursor -eq $line.Length) {
[Microsoft.PowerShell.PSConsoleReadLine]::AcceptSuggestion()
}
else {
[Microsoft.PowerShell.PSConsoleReadLine]::EndOfLine()
}
}
@dstcruz
dstcruz / Hack.hs
Created March 29, 2013 18:40
First draft of an assembler for the Hack machine ("From NAND to Tetris" fame). This does not have any good error handling, and, as you can see, there are no comments.
{-
Known to work with:
The Glorious Glasgow Haskell Compilation System, version 7.4.2
Extra library dependency:
Safe
To compile:
ghc -o HackAssembler Hack.hs
@dstcruz
dstcruz / gist:4047355
Created November 9, 2012 18:26
Nice to use with haskell :)
(defun my-align-single-equals ()
"Align on a single equals sign (with a space either side)."
(interactive)
(align-regexp
(region-beginning) (region-end)
"\\(\\s-*\\) = " 1 0 nil))
(global-set-key (kbd "C-c a") 'my-align-single-equals)