$ 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
// 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>>(); |
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
// 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
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
#!/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
// | |
// TaskLauncher.h | |
// sandbox-nstask | |
// | |
// Created by Ivan Burlakov on 11/12/15. | |
// Copyright © 2015 Ivan Burlakov. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
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 amount of 1 digits in given number | |
function calc(num) { | |
var digits = 0; | |
do { | |
if (num & 1) { | |
digits++; | |
} | |
num = num >>> 1 | |
} while (num != 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
NSString * | |
getDomainName() { | |
// "dsconfigad --show" command returns domain which mac joined to or nothing if mac is not joined to any domain | |
NSTask *task = [[NSTask alloc] init]; | |
[task setLaunchPath:@"/usr/sbin/dsconfigad"]; | |
[task setArguments: [NSArray arrayWithObjects:@"--show", nil]]; | |
NSPipe *pipe = [NSPipe pipe]; | |
[task setStandardOutput: pipe]; | |
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.Windows; | |
using System.Windows.Controls; | |
using System.Windows.Media; | |
namespace iburlakov | |
{ | |
public class CalloutBorder : Decorator | |
{ | |
private const double DEFAULT_POINTER_HEIGTH = 20D; | |
private const double DEFAULT_POINTER_WIDTH = 10D; |
NewerOlder