- 1
Get-NetTCPConnection -State Listen | %{[pscustomobject]@{Port=$_.LocalPort; Process=$(Get-Process -Id $_.OwningProcess)}} | sort {[int]$_.Port}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−1
Get-NetTCPConnection -State Listen | %{[pscustomobject]@{Port=$_.LocalPort; Process=$(Get-Process -Id $_.OwningProcess)}} | sort {[int]$_.Port}
Давайте течь от powershell.
−1
Lemma mint_head_eq CR1 CR2 (te : TE) l m r (t t' : list TE) :
MInt CR1 (l, m, r) (te :: t) ->
MInt CR2 (l, m, r) t' ->
exists t'', t' = te :: t''.
Proof.
intros H1 H2.
inversion_ H1; inversion_ H2; (* generates 25 goals *)
match goal with
|- (exists _, te :: ?T = te :: _) => now exists T
end.
Qed.
Против метушни нет приёма.
+2
https://www.opennet.ru/opennews/art.shtml?num=53839
Facebook развивает TransCoder для перевода кода с одного языка программирования на другой
Инженеры из Facebook опубликовали транскомпилятор TransCoder, использующий методы
машинного обучения для преобразования исходных текстов с одного высокоуровневого
языка программирования на другой. В настоящее время предоставлена поддержка
трансляции кода между языками Java, C++ и Python. Например, TransCoder позволяет
преобразовать исходные тексты на Java в код на Python, а код на Python в исходные
тексты на Java. Наработки проекта реализуют на практике теоретические изыскания по
созданию нейронной сети для эффективной автоматической транскомпиляции кода и
распространяются под лицензией Creative Commons Attribution-NonCommercial 4.0,
разрешающей применение только для некоммерческих целей.
Фраза <<Перепиши на "PHP"> > может потерять свою актуальность, ведь можно будет автоматически переписывать на через нейросети.
−1
Подписывайтесь на мой канал
https://t.me/GovnokodChannel
И знакомым расскажите.
+1
Микросервисы - это хорошо или плохо?
0
# PowerShell
if ($a2[$j] -Match $a1[$i] -and $a1[$i] -notin $r -and $a1[$i] -ne "ohio") {
$r += $a1[$i]
}
https://www.codewars.com/kata/reviews/5be8395356b146add7000017/groups/5f4a316915fbdc0001e1c60b
Когда в тестах есть один случай, который может не пропустить твоё решение
из-за "ohio", кто-то просто решил добавить эту строку в исключении в условии.
// ТРЕБУЮ ДОБАВИТЬ PowerShell В СПИСОК GOVNOKOD.RU!
+1
https://core.telegram.org/constructor/passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow
Какой багор )))
+1
Я вот смотрю на Ричарда Столлмана... Вижу, как он всю жизнь рвёт на себе жопчик за халявное ПО...
И думаю: а что сделал ОН? Он написал "Photoshop"? Создал "Windows"? Разработал хоть что-то?
Знает ли он, что такое многочасовой, многодневный, многомесячный, а иногда и многолетний труд разработки?
Всё его достижение - это ТЕКСТ лицензии "GNU". Всё.
В чём смысл Ричарда Столлмана?
И, кстати, нахуй вообще нужны лицензии на халявное ПО?
+1
pub struct Vec { x: u32, y: u32, z: u32, }
pub extern "C" fn sum_c(a: &Vec, b: &Vec) -> Vec {
return Vec {x: a.x + b.x, y: a.y + b.y, z: a.z + b.z };
}
pub fn sum_rust(a: &Vec, b: &Vec) -> Vec {
return Vec {x: a.x + b.x, y: a.y + b.y, z: a.z + b.z };
}
Выхлоп:
example::sum_c:
mov eax, dword ptr [rsi]
add eax, dword ptr [rdi]
mov ecx, dword ptr [rsi + 4]
add ecx, dword ptr [rdi + 4]
mov edx, dword ptr [rsi + 8]
add edx, dword ptr [rdi + 8]
shl rcx, 32
or rax, rcx
ret
example::sum_rust:
mov ecx, dword ptr [rdx]
mov r8d, dword ptr [rdx + 4]
add ecx, dword ptr [rsi]
add r8d, dword ptr [rsi + 4]
mov edx, dword ptr [rdx + 8]
add edx, dword ptr [rsi + 8]
mov rax, rdi
mov dword ptr [rdi], ecx
mov dword ptr [rdi + 4], r8d
mov dword ptr [rdi + 8], edx
ret
«Дак йаже как Сишка!», «Даёшь пuтушатню в Ядро!»
https://godbolt.org/z/Tcnz75
rustc 1.46 (latest)
+2
Function/method calling convention. Here’s a simple example:
struct Foo { a: i32 }
impl Foo { fn bar(&mut self, val: i32) { self.a = val + 42; } }
fn main() {
let mut foo = Foo { a: 0 };
foo.bar(foo.a);
}
For now this won’t compile because of the borrowing but shouldn’t the compiler be smart enough to create a copy of foo.a before call?
I’m not sure but IIRC current implementation first mutably borrows object for the call and only then tries to borrow the arguments.
Is it really so and if yes, why?
Update: I’m told that newer versions of the compiler handle it just fine but the question still stands (was it just a compiler problem or the call definition has been changed?).
The other thing is the old C caveat of function arguments evaluation. Here’s a simple example:
let mut iter = “abc”.chars();
foo(iter.next().unwrap(), iter.next().unwrap(), iter.next().unwrap());
So would it be foo('a','b','c') or foo('c','b','a') call. In C it’s undefined because it depends on how arguments are passed on the current platform
(consider yourself lucky if you don’t remember __pascal or __stdcall).
In Rust it’s undefined because there’s no formal specification to tell you even that much.
And it would be even worse if you consider that you may use the same source for indexing the caller object like
handler[iter.next().unwrap() as usize].process(iter.next().unwrap()); in some theoretical bytecode handler
(of course it’s a horrible way to write code and you should use named temporary variables but it should illustrate the problem).
https://codecs.multimedia.cx/2020/09/why-rust-is-not-a-mature-programming-language/