This file contains 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 | |
class Cidr { | |
public string $raw; | |
public int $subnet; | |
public int $length; | |
public string $ip; | |
public function __construct(string $str) | |
{ |
This file contains 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
/** | |
* examples: | |
* 10.10.85.13/32 | |
* 10.10.85.13/24 | |
*/ | |
[$subnet, $mask] = explode('/', $cidr); | |
return (ip2long($clientIP) & ~((1 << (32 - $mask)) - 1)) == ip2long($subnet); |
This file contains 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
#!/usr/bin/env bash | |
RED='\033[0;31m' | |
GREEN='\033[0;32m' | |
NC='\033[0m' | |
echo -e "${RED}Red${NC}" | |
echo -e "${GREEN}Green${NC}" |
This file contains 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 | |
function number($str) { | |
$arr = str_split($str); | |
$sum = 0; | |
for ($i = count($arr) - 1; $i >= 0; $i--) { | |
$idx = ord(strtoupper($arr[$i])) - 64; | |
$sum += $idx * (26 ** (count($arr) - $i - 1)); | |
} |
This file contains 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
ip_addresses_*.txt |
This file contains 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 | |
/** | |
* Результат: | |
* Тестовый текст с тегом 1, | |
* Итак, счётчик 2, 3 - 4 | |
* И ещё 5 | |
* 6 | |
*/ | |
$text = <<<TEXT |
This file contains 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
ffmpeg -i input.mp4 -vf scale=1280:-1 -c:v libx264 -preset slow -c:a copy output.mp4 |
This file contains 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
package main | |
// About chickens | |
// https://habr.com/ru/post/348066 | |
import ( | |
crand "crypto/rand" | |
"fmt" | |
"math" | |
"math/rand" |
This file contains 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/sh | |
echo "Test CS-fixer" | |
echo "" | |
docker exec container_name sudo -u www-data /var/www/html/vendor/bin/php-cs-fixer fix --dry-run | |
if [ $? -gt 0 ] | |
then | |
echo "" | |
echo "Found ugly code, not pushing" |
NewerOlder