$ docker
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 | |
| DIR=$1 | |
| FORMAT=$2 | |
| FILES=$DIR/* | |
| for file in $FILES | |
| do | |
| filename="${file##*/}" | |
| name="${filename%.*}" |
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
| int partition(int[] arr, int si, int ei) | |
| { | |
| var pivot = arr[ei]; | |
| var pivotIndex = si; | |
| for (var i = si; i < ei; i++) | |
| { | |
| // swap if current is lesser than pivot | |
| if (arr[i] < pivot) | |
| { | |
| var t = arr[pivotIndex]; |
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
| // calculate the number of "ones" on tan integer | |
| function calculate(num) { | |
| let count = 0; | |
| do { | |
| count += num & 1; | |
| num = num >> 1; | |
| } while (num); | |
| return 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
| function isPalindrome(str) { | |
| if (!str) return false; | |
| let i = 0; | |
| do { | |
| if (str[i] != str[str.length - 1 - i]) { | |
| return false; | |
| } | |
| i++; | |
| }while(i < str.length - i); |
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
| // setup | |
| var services = new ServiceCollection(); | |
| services.AddLogging(logging => | |
| { | |
| logging.AddSerilog(new LoggerConfiguration().ReadFrom.Configuration(Configuration).Enrich.FromLogContext().CreateLogger()); | |
| }); | |
| var serviceProvider = services.BuildServiceProvider(); | |
| // using | |
| var logger = _serviceProvider.GetRequiredService<ILogger<Function>>(); |
OlderNewer