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
| locals { | |
| tierpoint_provider = "tierpoint.provider" | |
| bck_folder = "./backup-ec2-scripts" | |
| backup_script_map = { | |
| for name in [for f in fileset(local.bck_folder, "*") : f if f != "user-data.sh"] : | |
| name => templatefile("${local.bck_folder}/${name}", { | |
| region = "${var.region}", | |
| borg_bucket_name = "${aws_s3_bucket.s3_borg_bucket.id}", | |
| lz_bucket_name = "${aws_s3_bucket.s3_lz_bucket.id}", | |
| binaries_bucket_name = "${var.binaries_bucket_name}", |
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.Diagnostics; | |
| public static class CommandLine | |
| { | |
| /// <summary> | |
| /// Helper to run an external process and capture stdout. | |
| /// </summary> | |
| public static Task<string> RunProcessAsync(string fileName, string args) | |
| { | |
| var psi = new ProcessStartInfo |
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
| sudo openssl dgst -sha256 -sign /var/s3-backup/certs/client/client.key -out - <<< "test" | sudo openssl base64 -in - -out signature.txt |
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 | |
| host_name="$(sed 's/[\[]/\\[/g; s/[\]]/\\]/g; s/[(]/\\(/g; s/[)]/\\)/g' <<< "$1")" | |
| task_name="$(sed 's/[\[]/\\[/g; s/[\]]/\\]/g; s/[(]/\\(/g; s/[)]/\\)/g' <<< "$2")" | |
| start_pattern="TASK \[$task_name\]" | |
| host_pattern=": \[$host_name\] => " | |
| # State machine flags | |
| found_task=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
| export $(cat .env | xargs) |
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
| AWSTemplateFormatVersion: "2010-09-09" | |
| Description: Template to deploy funding-arbitrage futures instance | |
| Metadata: | |
| cfn-lint:AWSTemplateFormatVersion: "2010-09-09" | |
| Description: Template to deploy funding-arbitrage futures instance | |
| Metadata: |
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
| function Execute-NonQuery([psobject[]]$sqlCommands, $connectionString) { | |
| $connection = new-object system.data.SqlClient.SQLConnection($connectionString) | |
| $connection.Open() | |
| $command = $connection.CreateCommand() | |
| $transaction = $connection.BeginTransaction() | |
| $command.Connection = $connection | |
| $command.Transaction = $transaction | |
| try { |
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
| function Get-DataSet($sqlCommand, $parameters, $connectionString) { | |
| $connection = new-object system.data.SqlClient.SQLConnection($connectionString) | |
| $command = new-object system.data.sqlclient.sqlcommand($sqlCommand,$connection) | |
| $dataset = New-Object System.Data.DataSet | |
| $parameters | Select-Object -ExpandProperty Keys | %{ | |
| $command.Parameters.Add($_, $parameters[$_]) | |
| } | |
| try{ |
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
| FallbackCredentialsFactory.CredentialsGenerators.Insert(0, () => | |
| { | |
| var profileName = Environment.GetEnvironmentVariable("AWS_PROFILE"); | |
| if (string.IsNullOrWhiteSpace(profileName)) return null; | |
| var chain = new CredentialProfileStoreChain(); | |
| return !chain.TryGetProfile(profileName, out var profile) ? null : new BasicAWSCredentials(profile.Options.AccessKey, profile.Options.SecretKey); | |
| }); |
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
| public static class StaticAsyncMediator | |
| { | |
| private static readonly IDictionary<string, object> | |
| CompletionSources = new ConcurrentDictionary<string, object>(); | |
| private static TaskCompletionSource<T> GetCreateSource<T>(string key) | |
| { | |
| var fullKey = $"{typeof(T).FullName}:{key}"; | |
| if (CompletionSources.ContainsKey(fullKey) && CompletionSources.TryGetValue(fullKey, out var returnValue)) | |
| return (TaskCompletionSource<T>) returnValue; |
NewerOlder