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.Linq; | |
| using BenchmarkDotNet.Attributes; | |
| using BenchmarkDotNet.Configs; | |
| using BenchmarkDotNet.Running; | |
| using NUnit.Framework; | |
| namespace TestProject1 | |
| { |
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 VeliExtensions | |
| { | |
| public static IEnumerable<T> ToListTakeWhile<T>(this IEnumerable<T> source, Predicate<T> predicate) | |
| { | |
| return source.TakeWhile(item => !predicate(item)); | |
| } | |
| } | |
| public class VeliExtensionTests | |
| { |
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
| # Two perfect logicians, S and P, are told that integers x and y have been chosen such that 1 < x < y and x+y < 100. | |
| # S is given the value x+y and P is given the value xy. They then have the following conversation. | |
| # P: I cannot determine the two numbers. | |
| # S: I knew that. | |
| # P: Now I can determine them. | |
| # S: So can I. | |
| # Given that the above statements are true, what are the two numbers? | |
| require 'prime' | |
| check_sum = ->(x) { (2..x / 2).any? { |a| Prime.prime?(a) && Prime.prime?(x - a) }} | |
| build_variation = ->(x) { (2..x / 2).map { |a| [a * (x - a), x, a] }} |
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
| version: '3.1' | |
| services: | |
| elasticsearch: | |
| image: elasticsearch | |
| container_name: elasticsearch | |
| environment: | |
| - bootstrap.memory_lock=true | |
| - ES_JAVA_OPTS=-Xms512m -Xmx512m | |
| command: | |
| - "-Etransport.host=0.0.0.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
| # put it under ~/.config/fish/functions | |
| function delete_archives_from_aws_glacier_vault -a ACCID VAULT | |
| set JOBID ( \ | |
| aws glacier initiate-job \ | |
| --account-id $ACCID \ | |
| --vault-name $VAULT \ | |
| --job-parameters '{"Type": "inventory-retrieval"}' \ | |
| | jq -r '.jobId' \ | |
| ) |
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
| [hooks] | |
| precommit.bigfile = hg diff | powershell -c "$input |?{$_.StartsWith('diff')}| %{$_.Split(' ')[3]}| %{if((gi $_).length -ge 1000000){ write-host $_ ":" (gi $_).length "bytes, must be less than 1Mb"; exit 1;}}" |