- 1
- 2
- 3
- 4
- 5
http://varikvalefor.i2p
https://github.com/varikvalefor
http://varikvalefor.neocities.org/
Кто в ш2з бывает, особенно рекомендую прорваться по первой ссылке.
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
0
http://varikvalefor.i2p
https://github.com/varikvalefor
http://varikvalefor.neocities.org/
Кто в ш2з бывает, особенно рекомендую прорваться по первой ссылке.
Дискасс. Вечером скину основные тейки из ш2з для клирнетовцев.
−1
#include <stdio.h>
int main() {
char* pituh;
puts(pituh);
pituh = "kokoko";
return 0;
}
Угадайте что выведет код?
ISO и прочим скилловикам просьба воздержаться.
https://ideone.com/sYrqiB
0
template<int I> struct Tag {};
template<int I>
struct StaticMock : mirage::ecs::Component<StaticMock<I>>
{
static bool initializeds;
void initialize(void)
{
initializeds = true;
}
};
template<>
struct StaticMock<2> : mirage::ecs::Component<StaticMock<2>>
{
static bool initializeds;
void initialize(Tag<2>&)
{
initializeds = true;
}
};
template<int I>
inline bool StaticMock<I>::initializeds = false;
inline bool StaticMock<2>::initializeds = false;
using Tag1 = Tag<1>;
using StaticMock1 = StaticMock<1>;
using Tag2 = Tag<2>;
using StaticMock2 = StaticMock<2>;
MIRAGE_CREATE_ON_STARTUP(StaticMock<0>, staticOnStartMock);
MIRAGE_CREATE_ON_EVENT(Tag1, StaticMock1);
MIRAGE_CREATE_WITH_EVENT(Tag2, StaticMock2);
TEST(Ecs, StaticOnStart)
{
EXPECT_EQ(StaticMock<0>::initializeds, true);
}
TEST(Ecs, StaticOnEvent)
{
EXPECT_NE(StaticMock1::initializeds, true);
mirage::event::enqueueEvent<Tag1>();
std::this_thread::sleep_for(std::chrono::milliseconds(
mirage::ecs::processing::EventDispatcherProcessing::updatePeriod * 2));
EXPECT_EQ(StaticMock1::initializeds, true);
}
TEST(Ecs, StaticWithEvent)
{
EXPECT_NE(StaticMock2::initializeds, true);
mirage::event::enqueueEvent<Tag2>();
std::this_thread::sleep_for(std::chrono::milliseconds(
mirage::ecs::processing::EventDispatcherProcessing::updatePeriod * 2));
EXPECT_EQ(StaticMock2::initializeds, true);
}
0
try
{
}
catch(...) { /*um, nice weather!*/}
−2
package main
func main() {
var str = "Hello World"
var length = len([]rune(str))
println("Length of the string is :", length)
}
String Length in Golang
To get the length of a String in Go programming, convert the string to array of runes, and pass this array to len() function.
0
#include <iostream>
int main() {
const char* pituh = {};
std::cout << pituh;
}
Нахуя?
−1
Электрика / электроника #6
#1: https://govnokod.ru/25437 https://govnokod.xyz/_25437
#2: https://govnokod.ru/25820 https://govnokod.xyz/_25820
#3: https://govnokod.ru/26570 https://govnokod.xyz/_26570
#4: https://govnokod.ru/27622 https://govnokod.xyz/_27622
#5: https://govnokod.ru/27741 https://govnokod.xyz/_27741
0
with Ada.Unchecked_Conversion;
with Interfaces.C;
with System.Address_To_Access_Conversions;
with System.Address_Operations; use System.Address_Operations;
with VGA_Console; use VGA_Console;
procedure Crash (Source_Location : System.Address; Line : Integer) is
package C renames Interfaces.C;
-- Get the length of the C NULL terminated string.
function Length (Source_Location : System.Address) return C.size_t is
use type C.size_t;
function Convert is new Ada.Unchecked_Conversion (Source => C.size_t,
Target => System.Address);
package To_Char is new System.Address_To_Access_Conversions (Object => C.char);
Count : C.size_t := 0;
Char : To_Char.Object_Pointer := To_Char.To_Pointer (AddA (Source_Location, Convert (Count)));
begin
while C.char'Pos (Char.all) /= 0 loop
Count := Count + 1;
Char := To_Char.To_Pointer (AddA (Source_Location, Convert (Count)));
end loop;
return Count;
end Length;
-- This is really ugly, just to convert an address pointing to a C NULL terminated string to an Ada String!
Source_Length : constant C.size_t := Length (Source_Location);
type Source_Chars is new C.char_array (0 .. Source_Length);
C_Str : Source_Chars with
Address => Source_Location;
pragma Import (Convention => Ada, Entity => C_Str);
Source_Str : constant String := C.To_Ada (C.char_array (C_Str));
begin
Put (Str => "** Kernel crashed at: " & Source_Str & ":" & Integer'Image (Line) & " **",
X => 1,
Y => 10,
Foreground => White,
Background => Red);
-- TODO: Dump registers.
Hang : loop
null;
end loop Hang;
end Crash;
−2
try:
self._api = caller(self.url)
except ValueError as e:
logging.error(f"Не удалось инициализировать класс API: ({str(e)})")
raise ValueError(str(e))
0
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(lib, "ntdll.lib")
#include <Windows.h>
#include <string>
#define FLG_HEAP_ENABLE_TAIL_CHECK 0x10
#define FLG_HEAP_ENABLE_FREE_CHECK 0x20
#define FLG_HEAP_VALIDATE_PARAMETERS 0x40
#define NT_GLOBAL_FLAG_DEBUGGED (FLG_HEAP_ENABLE_TAIL_CHECK | FLG_HEAP_ENABLE_FREE_CHECK | FLG_HEAP_VALIDATE_PARAMETERS)
typedef NTSTATUS(NTAPI* pfnNtSetInformationThread)(
_In_ HANDLE ThreadHandle,
_In_ ULONG ThreadInformationClass,
_In_ PVOID ThreadInformation,
_In_ ULONG ThreadInformationLenght);
const ULONG ThreadHideFromDebugger = 0x11;
typedef NTSTATUS(NTAPI* pfnNtQueryInformationProcess)(
_In_ HANDLE ProcessHandle,
_In_ ULONG ProcessInformationClass,
_In_ PVOID ProcessInformation,
_In_ ULONG ProcessInformationLenght,
_Out_opt_ PULONG ReturnLenght);
const UINT ProcessDebugPort = 7;
void HideFromDebugger()
{
HMODULE hNtDll = LoadLibrary("ntdll.dll");
if (!hNtDll)
throw std::exception("can't load kernel");
pfnNtSetInformationThread NtSetInformatioThread = (pfnNtSetInformationThread)
GetProcAddress(hNtDll, "NtSetInformationThread");
NTSTATUS status = NtSetInformatioThread(GetCurrentThread(), ThreadHideFromDebugger, NULL, NULL);
}
PVOID GetPEB()
{
return (PVOID)__readfsword(0x0C * sizeof(PVOID));
}
int main()
{
pfnNtQueryInformationProcess NtQueryInformationProcess = nullptr;
NTSTATUS status;
DWORD IsDebuggerPresent = 0;
HMODULE hNtDll = LoadLibrary("ntdll.dll");
if (!hNtDll)
throw std::exception("can't load kernel");
NtQueryInformationProcess = (pfnNtQueryInformationProcess)GetProcAddress(hNtDll, "NtQueryInformationProcess");
void HideFromDebugger();
while (true)
{
PVOID pPEB = GetPEB();
DWORD offsetNtGlobalFlag = 0x68;
DWORD NtGlobalFlag = (DWORD)((PBYTE)pPEB + offsetNtGlobalFlag);
NTSTATUS stat = NtQueryInformationProcess(GetCurrentProcess(), ProcessDebugPort,
&IsDebuggerPresent, sizeof(DWORD), NULL);
if ((NtGlobalFlag & NT_GLOBAL_FLAG_DEBUGGED) || (stat == 0x00000000 && IsDebuggerPresent != 0))
{
MessageBox(NULL, "Close your fucking debuger!", "FUCK YOU", MB_OK);
return -1;
}
}
return 0;
}