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 class Program | |
{ | |
public static async Task Main(string[] args) | |
{ | |
using var dataResponse = await client.GetAsync(); | |
dataResponse.EnsureSuccessStatusCode(); | |
await using var stream = await dataResponse.Content.ReadAsStreamAsync(); | |
var pipe = PipeReader.Create(stream); |
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
<?php | |
/** | |
* Add the field to the checkout | |
**/ | |
add_action('woocommerce_after_order_notes', 'my_custom_checkout_field'); | |
function my_custom_checkout_field( $checkout ) { | |
echo '<div id="my_custom_checkout_field"><h3>'.__('My Field').'</h3>'; |
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
require 'date' | |
dates = [] | |
lapses = [] | |
File.open('/var/log/apache2/pogoda/access.log.1').each do |line| | |
next if line =~ /\.(js|css|gif|png|jpe?g)/i | |
dates.push(DateTime.strptime(line[/(\d+\/\w{3}\/\d{4}(:\d{2}){3})/,1], '%d/%b/%Y:%k:%M:%S').to_time) | |
end | |
dates.each_cons(2) do |pair| |
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 | |
filename='/var/log/apache2/pogoda/access.log.1' | |
SEDFORMAT='s/([0-9]+)\/(.+)\/([0-9]+):([0-9]+:[0-9]+:[0-9]+)/\2 \1 \4 \3/' | |
PREV_EPOCH=$(date +%s -d "$(head -n1 $filename|grep -P -o '(\d+/\w{3}/\d{4}(:\d{2}){3})'|sed -r -e 's/([0-9]+)\/(.+)\/([0-9]+):([0-9]+:[0-9]+:[0-9]+)/\2 \1 \4 \3/')") | |
COUNT=0 | |
SUM=0 |