This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:- set_prolog_flag(double_quotes, codes). | |
:- use_module(library(dcg/basics)). | |
:- use_module(library(pio)). | |
% edit this to your input path | |
inputPath('C:/inputs/day01.txt'). | |
% A line has two numbers separated by whitespace. | |
line(Left, Right) --> | |
number(Left), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// a naive Rust port of a PowerShell brute-force Sudoku solver | |
// trying to keep everything as close to the same implementation as possible. | |
fn main() { | |
let mut board : [[i8; 9]; 9] = [ | |
[0,0,0, 0,3,0, 0,0,0], | |
[0,0,1, 0,7,6, 9,4,0], | |
[0,8,0, 9,0,0, 0,0,0], | |
[0,4,0, 0,0,1, 0,0,0], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::env; | |
fn main() { | |
// vector of prime "hashes", sorted so they can be binary searched | |
let lookup_primes : Vec<i64> = vec![11794860,11846142,12512808,15655440,16956360,18137400,18346020,21651280,22123600,25956240,29902200,31549560,40300260,42095196,42597520,44697576,45014200,46852656,49206300,51447780,52811220,65410224,71180340,71722280,80102484,80854620,86665840,87931500,93458568,99722800,100683660,103230666,103799850,105129432,108746484,109035300,111985020,113384502,119599788,124081320,125368650,129507400,130227900,136800600,137434220,140220850,150346392,151367370,155189100,156605460,156632322,164712900,172051110,174106200,180333560,181234350,182071890,188839860,191423100,194597480,196068180,197110452,198917950,204831408,209420750,211333276,211967376,214322280,217467684,220101420,220101420,220644468,228171720,234393720,238368300,239007760,245070980,246202440,246705690,248471300,253137720,257298888,257397140,264279246,264964968,265756260,268660700,272580924,280854420,282643740,291984660,29201 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using namespace System.Collections.Generic | |
using namespace System.Management.Automation | |
using namespace System.Security.AccessControl | |
using namespace Microsoft.Win32 | |
function Get-InstalledSoftware { | |
[CmdletBinding()] | |
param( | |
[Parameter(ValueFromPipeline)] | |
[ValidateNotNullOrEmpty()] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#source of the main script : "https://gist.github.com/indented-automation/32efb05a5fb67ef9eed02bbb8fe90691" | |
#source of the Regex filtering : "https://github.com/gangstanthony/PowerShell/blob/master/Get-InstalledApps.ps1" | |
filter Get-InstalledSoftware { | |
<# | |
.SYNOPSIS | |
Get all installed from the Uninstall keys in the registry. | |
.DESCRIPTION | |
Read a list of installed software from each Uninstall key. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tioCode←{ | |
⍝ decodes a TIO.run link such as | |
⍝ tioCode 'https://tio.run/##SyzI0U2pTMzJT////1Hf1EdtExSMFYwf9W551LvZkgsioq4OZSg86lzwqHcFkor//wE' | |
⍝ load dfns workspace to use base64 decoder | |
_←{(⍎⍵ ⎕NS ⍬).⎕CY ⍵}'dfns' | |
⎕USING←'System' 'System.Net,System.dll' | |
hash←('^https://tio\.run/##'⎕R'')⍵ ⍝ remove web address parts of the link |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Imports the table.tsv file from APLCart | |
# Decodes the TIO.run links | |
# Shows in Out-Gridview | |
$tablePath = "c:\sc\aplcart\table.tsv" | |
$csharp = @' | |
using System; | |
using System.IO; | |
using System.Net; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TIO Link verify helper for APLCart. | |
# Open this file in PowerShell ISE on Windows (or other Unicode-aware console, e.g. VS Code + PowerShell extension, new Windows Terminal; not basic PowerShell window) | |
# Update $tablePath to point to the table. | |
# Update the string of codes to find. | |
# Run. | |
$tablePath = "c:\sc\aplcart\table.tsv" | |
$codesToFind = @' | |
0∘×N |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright: (c) 2020, Jordan Borean (@jborean93) <jborean93@gmail.com> | |
# MIT License (see LICENSE or https://opensource.org/licenses/MIT) | |
Add-Type -Namespace PInvoke -Name NativeMethods -MemberDefinition @' | |
[DllImport("Kernel32.dll")] | |
public static extern bool CloseHandle( | |
IntPtr hObject); | |
[DllImport("Advapi32.dll", SetLastError = true)] | |
public static extern bool ImpersonateLoggedOnUser( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
((0>⊣)⌽((⊂↑),(⊂↓))) ⍝ 1. Let's Split | |
(⊢⊂⍨(128∘>∨191∘<)) ⍝ 2. Characters | |
{26⊥⎕A⍳⍵} ⍝ 3. Columns | |
{(0=400|⍵)∨(≠⌿0=4 100∘.|⍵)} ⍝ 4. Take a Leap | |
{⎕IO←0 ⋄ ⌽⍣(>/⍵)⊢(⌊/⍵)+⍳1+(⌈/-⌊/)⍵} ⍝ 5. Stepping | |
{⍵[⍒⍺=⍵]} ⍝ 6. Move To Front | |
{⍺=2⊥bits∧⍺⊤⍨2⍴⍨≢bits←2⊥⍣¯1⊢⍵} ⍝ 7. Bits | |
{(∨/(1 ¯1⍴⍨≢)⍷⍨(×2-/⊢))10⊥⍣¯1⊢⍵} ⍝ 8. Zigzag | |
{peak←(⊢⍳⌈/),⍵ ⋄ notDesc←(⍳∘≢≡⍋) ⋄ (notDesc peak↑⍵) ∧ (notDesc ⌽peak↓⍵)} ⍝ 9. Rise and fall | |
⍝ 10. Stacking It Up - not done |
NewerOlder