This file contains hidden or 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::{io::{self, Write}, str::FromStr}; | |
| fn main() { | |
| let name = input("What's your name? "); | |
| let number: f64 = input_num("What's your favorite number? "); | |
| println!("{name}'s favorite number is {number:.2}."); | |
| } | |
| fn input(prompt: &str) -> String { | |
| let mut line = String::new(); |
This file contains hidden or 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
| const int HOMEPLANET = 9; | |
| const int MINTRIP = 5; | |
| void Main() | |
| { | |
| var exoplanets = new List<int> { 3,4,8,4,7,8,6,2 }; | |
| var jumps = getFirstTwo(exoplanets); | |
| var tripsHome = new Dictionary<string,List<int>>(); | |
| while (jumps.Count > 0) |
This file contains hidden or 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
| #!/bin/bash | |
| aws dynamodb execute-statement --statement \ | |
| "SELECT * FROM SkiLifts" | \ | |
| # Json Output | |
| #jq -c '.Items[] | select(.LiftStatus.S=="Open") | { Lift:.Lift.S, LiftStatus:.LiftStatus.S }' | |
| # CSV Values Output | |
| jq -r -c '.Items[] | select(.LiftStatus.S=="Open") | [.Lift.S, .LiftStatus.S ] | @csv' |
This file contains hidden or 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
| # This script assumes it is being run from powershell "run as administrator" prompt. | |
| # | |
| # The script will check if it has already been run (FileBackupTo already exists), | |
| # otherwise it will backup the target FileToUpdate and replace it with the $NewFile. | |
| # It sets the updated file to "read only" | |
| # The following paths must be updated as needed: | |
| # The current assumption is $NewFile is in the same directory as this script, | |
| $FileToUpdate = "C:\Program Files\ATT Metrology\LTASWpf\LTAS30Block20.xit64" |
This file contains hidden or 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
| provider "aws" { | |
| region = "us-west-2" | |
| } | |
| data "aws_canonical_user_id" "current_user" {} | |
| resource "aws_s3_bucket" "deployment_bucket" { | |
| bucket = "limpidfox-lambdas-dev" | |
| acl = "private" | |
| server_side_encryption_configuration { |
This file contains hidden or 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 System; | |
| using System.Collections.Generic; | |
| using System.Text; | |
| using System.Linq; | |
| public class Graph<T> { | |
| Dictionary<T,List<T>> vertices; | |
| Dictionary<T,bool> marked; | |
| Dictionary<T,int> componentIds; | |
| Dictionary<T,bool> color; |
This file contains hidden or 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 System.Collections.Generic; | |
| internal class BFSPaths<T> | |
| { | |
| Graph<T> g; | |
| T s; | |
| Dictionary<T,T> edgeTo = new Dictionary<T,T>(); | |
| public BFSPaths(Graph<T> g, T s) | |
| { |
This file contains hidden or 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
| private static void TestWordChains() | |
| { | |
| var dict = File.ReadAllLines("words.txt").Where(w=>!w.Contains("'")).ToList(); | |
| var stopWatch = new Stopwatch(); | |
| stopWatch.Start(); | |
| var path = MakeWordChains(dict,"game","over"); | |
| stopWatch.Stop(); | |
| System.Console.WriteLine($"Time in Seconds: {stopWatch.ElapsedMilliseconds/1000.0}"); | |
| path.Dump(); | |
| AssertAreEqual(10,path.Count); |
This file contains hidden or 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
| void Main() | |
| { | |
| var n = new NuggetSaver(7,11); | |
| (n.BestOrder(20) == (3, 0)).Dump(); | |
| (n.BestOrder(100) == (8, 4)).Dump(); | |
| (n.BestOrder(-20) == (0, 0)).Dump(); | |
| (n.BestOrder(1000000) == (142854, 2)).Dump(); | |
| } | |
| class NuggetSaver |
This file contains hidden or 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
| void Main() | |
| { | |
| var n = new NuggetSaver(7,11); | |
| (n.OrderNuggets(20) == (3, 0)).Dump(); | |
| (n.OrderNuggets(100) == (8, 4)).Dump(); | |
| (n.OrderNuggets(-20) == (0, 0)).Dump(); | |
| } | |
| class NuggetSaver |