- 1
- 2
- 3
use Unicornify::URL;
my $url = unicornify_url( email => '[email protected]' );
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+1
use Unicornify::URL;
my $url = unicornify_url( email => '[email protected]' );
https://metacpan.org/pod/Unicornify::URL
+1
Функция УбратьПробел(стрЧисло)
//убирает пустой пробел
нСтр = "";
Для п=1 По СтрДлина(стрЧисло) Цикл
р = Сред(стрЧисло,п,1);
Если р = "1" ИЛИ р = "2" ИЛИ р = "3" ИЛИ р = "4" ИЛИ р = "5" ИЛИ р = "6" ИЛИ р = "7" ИЛИ р = "8" ИЛИ р = "9" ИЛИ р = "0" ИЛИ р = "," Тогда
нСтр = нСтр+р;
КонецЕсли;
КонецЦикла;
Возврат нСтр;
КонецФункции
Senior
+1
#!/usr/bin/perl
# Fetch all JS from govno
use strict;
use warnings FATAL => 'all';
use LWP;
my $res = LWP::UserAgent->new->request(HTTP::Request->new("GET" => "http://govnokod.xyz/"));
die "Failed: " . $res->code unless $res->is_success;
for (split /\n/, $res->content) {
print if /<script/ ... /script>/ and !m/[<>]/;
}
кууик.
Официальный тред для ржания над пятым перлом
+1
import re, copy, json
config = {}
def domain_mapper(domain):
def injector(f):
if domain not in config:
config[domain] = []
config[domain].append(f)
return injector
def default(f):
config['default'] = [f]
return f
@domain_mapper("gmail.com")
@default
def google_filter(content):
regex = r"([^\!\?\.]*?offer.*?[\!\?\.])"
repl = r""
return re.sub(regex, repl, content, re.M)
@domain_mapper("gmail.com")
def another_google_filter(content):
return content
@domain_mapper("yandex.ru")
def yandex_filter(content):
regex = r"<img src=[\"'](.+?)[\"'].*/>"
repl = r"\1"
return re.sub(regex, repl, content, re.M)
@domain_mapper("mail.ru")
def mail_filter(content):
regex = r"<img src=[\"'](.+?)\.gif[\"'].*/>"
repl = r"<img src='\1.png'/>"
return re.sub(regex, repl, content, re.M)
Говно или нет?
+1
SCRIPT="<?php http_response_code(429); ob_clean(); //" php -S localhost:80 /proc/self/environ
sql injection is for kids, grownups use environment variable injection
+1
import java.util.Scanner;
public class ComputeTax {
public static void main(String[] args) {
// Create a Scanner
Scanner input = new Scanner(System.in);
// Prompt the user to enter filing status
System.out.print(
"(0-single filer, 1-married jointly or qualifying widow(er)",
+ "\n2-married separately, 3-head of household)\n" +
"Enter the filing status: ");
int status = input.nextInt();
// Prompt the user to enter taxable income
System.out.print("Enter the taxable income: ");
double income = input.nextDouble();
// Compute tax
double tax = 0;
if (status == 0) {// Compute tax for single filers
if (income <= 8350)
tax = income * 0.10;
else if (income <= 33950)
tax = 8350 * 0.10 + (income - 8350) * 0.15;
else if (income <= 82250)
tax = 8350 * 0.10 + (33950 - 8350) * 0.15 +
(income - 33950) * 0.25;
else if (income <= 171550)
tax = 8350 * 0.10 + (33950 - 8350) * 0.15 +
(82250 - 33950) * 0.25 + (income - 82250) * 0.28;
else if (income <= 372950)
tax = 8350 * 0.10 + (33950 - 8350) * 0.15 +
(82250 - 33950) * 0.25 + (171550 - 82250) * 0.28 +
(income - 171550) * 0.33;
else
tax = 8350 * 0.10 + (33950 - 8350) * 0.15 +
(82250 - 33950) * 0.25 + (171550 - 82250) * 0.28 +
(372950 - 171550) * 0.33 + (income - 372950) * 0.35;
}
else if (status == 1) {
// Left as exercise
// Compute tax for married file jointly or qualifying widow(er)
}
else if (status == 2) {
// Compute tax for married separately
// Left as exercise
}
else if (status == 3) {
// Compute tax for head of household
// Left as exercise
}
else {
System.out.println("Error: invalid status");
System.exit(1);
}
// Display the result
System.out.println("Tax is " + (int)(tax * 100) / 100.0);
}
+1
const getSizeString = (size: number) => {
const mesuarments = ["Б", "кБ", "МБ", "ГБ"];
let i = 0;
for (; size/1024 > 1; size /= 1024, i++)
;
return ${Math.floor(size) === size ? size : (size).toFixed(1)} ${mesuarments[i]};
}
+1
class Container:
def __init__(self, liquid):
self.liquid = liquid
def look_inside(self):
return f"{self.liquid} in container"
@classmethod
def create_with(cls, liquid):
return cls(liquid)
class Bottle(Container):
def look_inside(self):
return f"bottle full of {self.liquid}"
class Glass(Container):
def look_inside(self):
return f"A glass of {self.liquid}"
for c in (c.create_with("beer") for c in [Glass, Bottle]):
print(c.look_inside())
ми маємо class polymorphism
+1
<p oncopy="return false" ondragstart="return false"></p>
<p oncopy="return false" ondragstart="return false"></p>
<p oncopy="return false" ondragstart="return false"></p>
<p oncopy="return false" ondragstart="return false"></p>
<p oncopy="return false" ondragstart="return false"></p>
<p oncopy="return false" ondragstart="return false"></p>
<p oncopy="return false" ondragstart="return false"></p>
<p oncopy="return false" ondragstart="return false"></p>
<p oncopy="return false" ondragstart="return false"></p>
Защита контента для самых маленьких
+1
#include <cstdio>
class tag;
template<class>
struct type { friend constexpr auto get(type); };
template<class TKey, class TValue>
struct set { friend constexpr auto get(TKey) { return TValue{}; } };
void foo() { // never called
if constexpr(false) { // never true
if (false) { // never true
constexpr auto call = [](auto value) { std::printf("called %d", value); };
void(set<type<tag>, decltype(call)>{});
}
}
}
int main() {
get(type<tag>{})(42); // prints called 42
}
https://twitter.com/krisjusiak/status/1186363017329594368
Какой C++20 )))