-
+1
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
// тред лоулевел-хаков #1
#include <stdio.h>
#include <stdlib.h>
void hello(void)
{
puts("Hello!");
}
void goodbye(void)
{
puts("Goodbye!");
}
void set_sp_(void *p)
{
void *s[0];
s[0] = p;
}
void set_sp(void *p)
{
set_sp_((void*)p);
}
int main(void)
{
void *new_stack[1024] = {
[1019] = (void*)0,
[1020] = (void*)&hello,
[1021] = (void*)&goodbye,
[1022] = (void*)&exit
};
set_sp((void*)&new_stack[1019]);
return 0;
}
UB-ы, платформенно зависимый кот, битовая магия
всё сюда
|
|
\/
Hu3KoypoBHeBblunemyx,
28 Января 2022
-
0
#114: https://govnokod.ru/27659 https://govnokod.xyz/_27659
#115: https://govnokod.ru/27665 https://govnokod.xyz/_27665
#116: https://govnokod.ru/27671 https://govnokod.xyz/_27671
#117: https://govnokod.ru/27675 https://govnokod.xyz/_27675
#118: https://govnokod.ru/27685 https://govnokod.xyz/_27685
#119: https://govnokod.ru/27701 https://govnokod.xyz/_27701
#120: https://govnokod.ru/27703 https://govnokod.xyz/_27703
#121: https://govnokod.ru/27710 https://govnokod.xyz/_27710
#122: https://govnokod.ru/27728 https://govnokod.xyz/_27728
#123: https://govnokod.ru/27729 https://govnokod.xyz/_27729
#124: https://govnokod.ru/27730 https://govnokod.xyz/_27730
#125: https://govnokod.ru/27732 https://govnokod.xyz/_27732
#126: https://govnokod.ru/27733 https://govnokod.xyz/_27733
#127: https://govnokod.ru/27737 https://govnokod.xyz/_27737
#128: https://govnokod.ru/27742 https://govnokod.xyz/_27742
#129: https://govnokod.ru/27747 https://govnokod.xyz/_27747
#130: https://govnokod.ru/27755 https://govnokod.xyz/_27755
#131: https://govnokod.ru/27766 https://govnokod.xyz/_27766
#132: https://govnokod.ru/27790 https://govnokod.xyz/_27790
#133: https://govnokod.ru/27828 https://govnokod.xyz/_27828
#134: https://govnokod.ru/27834 https://govnokod.xyz/_27834
#135: https://govnokod.ru/27839 https://govnokod.xyz/_27839
#136: https://govnokod.ru/27845 https://govnokod.xyz/_27845
#137: https://govnokod.ru/27857 https://govnokod.xyz/_27857
#138: https://govnokod.ru/27867 https://govnokod.xyz/_27867
#139: https://govnokod.ru/27887 https://govnokod.xyz/_27887
#140: https://govnokod.ru/27900 https://govnokod.xyz/_27900
#141: https://govnokod.ru/27914 https://govnokod.xyz/_27914
#142: https://govnokod.ru/27942 https://govnokod.xyz/_27942
#143: https://govnokod.ru/27960 https://govnokod.xyz/_27960
nepeKamHblu_nemyx,
28 Января 2022
-
0
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
#!/usr/bin/env python3
import subprocess as sp
lines_pipe = sp.Popen(('xinput', 'list'), stdout=sp.PIPE)
id_line = str(sp.check_output(('grep', 'Touchpad'), stdin=lines_pipe.stdout))
a = id_line.index("id=") + 3
b = a
while id_line[b] in set(list("0123456789")):
b += 1
id = id_line[a:b]
status_pipe = sp.Popen(('xinput', 'list-props', id), stdout=sp.PIPE)
sp.run(('xinput', ['enable', 'disable'][int(str(sp.check_output(('grep', 'Device Enabled'), stdin=status_pipe.stdout))[-4]=='1')], id))
Предыдущий прыщескрипт на bash соснул, так как захардкоженный "id", оказалось, иногда может меняться, поэтому скрипт был благополучно перенесён на "Python".
JloJle4Ka,
27 Января 2022
-
+1
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
#include <stdio.h>
#include <string.h>
int main()
{
char* lalka = "bagor";
if (0!=strcmp(lalka, "bagor // comment ")) {
puts("Kakoi gabor )))");
}
if (0!=strcmp(lalka, "bagor")){
puts("Pituz!");
}
return 0;
}
https://ideone.com/RiM3LX
#stdout
Kakoi gabor )))
3.14159265,
27 Января 2022
-
+2
- 1
https://github.com/golded-plus/golded-plus/blob/master/golded3/gccfgg0.cpp#L162
CHayT,
25 Января 2022
-
0
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
class Foo {
std::atomic<bool> a{false};
std::atomic<bool> b{false};
public:
Foo()
{
}
void first(function<void()> printFirst) {
printFirst();
a.store(true, std::memory_order_release);
}
void second(function<void()> printSecond) {
while (!a.load(std::memory_order_acquire))
;
printSecond();
b.store(true, std::memory_order_release);
}
void third(function<void()> printThird) {
while (!b.load(std::memory_order_acquire))
;
printThird();
}
};
https://leetcode.com/problems/print-in-order/
36 / 36 test cases passed.
Runtime: 1697 ms
Memory Usage: 7 MB
Хочу, чтобы начался срач по поводу того, как достичь рантайма в 200мс
Nyanwitt,
24 Января 2022
-
0
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
.org 80h
fib:
push %b
push %d
push %c
mov %d [%sp + 8h]
mov %b 1h
mov %a 0h
.loop:
add %b %a
mov %c %a
mov %a %b
sub %a %c
dec %d
jnz @.loop
pop %c
pop %d
pop %b
ret
start:
mov %sp 2000h
push Fh
call @fib
pop
int 0h
один чел захотел написать для моей вмки компилятор лиспоподобного языка с некими S-выражениями и попросил пример вычисления ряда фибоначчи.
пришлось накопипастить с вики.
digitalEugene,
23 Января 2022
-
0
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
using System;
public class Program
{
public static void Main()
{
69.Doeb();
typeof(Ext).Doeb();
}
}
public static class Ext
{
public static void Doeb(this object o)
{
string s;
Type type = o.GetType();
s = type.ToString();
while(type != null)
{
type = type.BaseType;
try
{
s += $" > {type.ToString()}";
}
catch
{
break;
}
}
Console.WriteLine(s);
}
}
Ты с какого района? Чьих будешь?
SystemGCCollect,
22 Января 2022
-
0
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
services:
zookeeper:
image: docker.io/bitnami/zookeeper:3.7
environment:
ALLOW_ANONYMOUS_LOGIN: yes
volumes:
- zookeeper_data:/bitnami
volumes:
zookeeper_data:
Кто найдёт ошибку в docker-compose.yaml — тому нихуя.
ISO,
21 Января 2022
-
0
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
def number_to_words(n):
if n == 1:
print('один')
exit()
elif n == 2:
print('два')
exit()
elif n == 3:
print('три')
exit()
elif n == 4:
print('четыре')
exit()
elif n == 5:
print('пять')
exit()
elif n == 6:
print('шесть')
exit()
elif n == 7:
print('семь')
exit()
elif n == 8:
print('восемь')
exit()
elif n == 9:
print('девять')
exit()
elif n == 10:
print('десять')
exit()
elif n == 11:
print('одиннадцать')
exit()
elif n == 12:
print('двенадцать')
exit()
elif n == 13:
print('тринадцать')
exit()
elif n == 14:
print('четырнадцать')
exit()
elif n == 15:
print('пятнадцать')
exit()
elif n == 16:
print('шестнадцать')
exit()
elif n == 17:
print('семнадцать')
exit()
elif n == 18:
print('восемнадцать')
exit()
elif n == 19:
print('девятнадцать')
exit()
elif n == 20:
print('двадцать')
exit()
elif n == 21:
print('двадцать один')
exit()
elif n == 22:
print('двадцать два')
exit()
elif n == 23:
print('двадцать три')
exit()
elif n == 24:
print('двадцать четыре')
exit()
elif n == 25:
print('двадцать пять')
exit()
elif n == 26:
print('двадцать шесть')
exit()
elif n == 27:
print('двадцать семь')
exit()
elif n == 28:
print('двадцать восемь')
exit()
elif n == 29:
print('двадцать девять')
exit()
elif n == 30:
print('тридцать')
exit()
elif n == 31:
print('тридцать один')
exit()
elif n == 32:
print('тридцать два')
exit()
так до 99. Оригинал: https://www.cyberforum.ru/python-beginners/thread2390750.html
P.S. exit-ы то зачем????
makpif,
21 Января 2022