# Подключаем вставку путей по хоткею Ctrl-o
PushToShell() {
# Делим строку на: до курсора и после и вставляем путь между ними.
befCurs="${READLINE_LINE:0:READLINE_POINT}"
aftCurs="${READLINE_LINE:READLINE_POINT}"
READLINE_LINE="$befCurs$1$aftCurs"
# Сдвигаем курсор на длину пути
READLINE_POINT=$(($READLINE_POINT+$(echo -n "$1" | wc -m)))
}
FM_PastePath() {
dir="$(mktemp -t "FM_Dir.XXXXXXXXXX")"
file="$(mktemp -t "FM_File.XXXXXXXXXX")"
ranger --choosedir="$dir" --choosefile="$file" "${@:-$PWD}" #тут можно подключить любой другой ФМ.
PushToShell "$([ -s "$file" ] && cat "$file" || cat "$dir")"
rm -f "$dir"
rm -f "$file"
}
bind -x '"\C-o":"FM_PastePath"'
find /mnt/d/settingsMicro/ -type d -print -exec find "{}" -maxdepth 1 ! -type d \;
find /mnt/d/settingsMicro/ -type d -printf '%y %p/\n' -exec find "{}" -maxdepth 1 ! -type d -printf '%y %p\n' \;
find /mnt/d/settingsMicro/ -type d -exec find "{}" -maxdepth 0 -printf '%y %p/\n' \; -exec find "{}" -maxdepth 1 ! -type d -printf '%y %p\n' \;
public Task<PingReply> SendPingAsync(string host, int timeout, CancellationToken cancelToken)
{
TaskCompletionSource<PingReply> tcs = new TaskCompletionSource<PingReply>();
if (cancelToken.IsCancellationRequested)
tcs.TrySetCanceled();
else
{
using (Ping ping = new Ping())
{
ping.PingCompleted += (object sender, PingCompletedEventArgs e) =>
{
if (!cancelToken.IsCancellationRequested)
{
if (e.Cancelled)
tcs.TrySetCanceled();
else if (e.Error != null)
tcs.TrySetException(e.Error);
else
tcs.TrySetResult(e.Reply);
}
};
cancelToken.Register(() => {tcs.TrySetCanceled();});
ping.SendAsync(host, timeout, null);
}
};
return tcs.Task;
}
public static async Task ProcessingRequset(Tuple<string, string> address)
{
HttpWebResponseLink httpWebResponseLink = new HttpWebResponseLink();
try
{
HttpWebResponse response = (HttpWebResponse) await GetResponseAsync(address.Item1, address.Item2);
httpWebResponseLink.IsHttpWebResponseTaked = true;
httpWebResponseLink.httpWebResponseLink = response;
}
catch (Exception e)
{
httpWebResponseLink.IsHttpWebResponseTaked = false;
}
// логгирование и обработка результатов запроса
}
var tasks = list.Select(async x =>
{
var y = await IOProcessing(x);
var z = await IOProcessing(y);
Console.WriteLine(z);
});
Task.WhenAll(tasks).Wait();
Console.WriteLine(«Tasks completed»);