Skip to content

Instantly share code, notes, and snippets.

#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
const size_t BUFFERGROWTH = 128;
size_t getline_(char **lineptr, size_t *linesize, FILE *stream)
{
if (*lineptr == NULL) {
*lineptr = malloc(BUFFERGROWTH);
#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <assert.h>
const char* const ANSI_COLOR_RED = "\x1b[31m";
const char* const ANSI_COLOR_RESET = "\x1b[0m";
@Yepoleb
Yepoleb / loclock.c
Last active February 13, 2019 05:28
#include <sys/socket.h>
#include <netinet/ip.h>
#include <sys/time.h>
#include <assert.h>
#include <stdio.h>
#include <string.h>
int main(void)
{
struct sockaddr_in addr = {AF_INET};
#define _GNU_SOURCE 1
#include <ucontext.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
void action_handler(int sig, siginfo_t* info, void* context_p)
{
ucontext_t* ucontext = (ucontext_t*)context_p;
ucontext->uc_mcontext.gregs[REG_RIP] += 6;
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <time.h>
// Heuristically compare memory
int memcmp_heur(const void* lhs, const void* rhs, size_t length, float confidence)
{
# Script for emulating the Canon BJNP discover request
# License: CC0
import socket
import time
import itertools
import time
import select
from datetime import datetime
@Yepoleb
Yepoleb / aoc5.cpp
Last active December 5, 2018 17:43
#include <fstream>
#include <string>
#include <limits.h>
class CharStream
{
public:
CharStream(char* str, int size_) :
#include <stdio.h>
// Drawing the numbers left from the center
#define FLAG_LEFT (1 << 30)
// Drawing right from the center
#define FLAG_RIGHT (1 << 29)
// Used to remove flags from a number
#define NOFLAG_MASK ((1 << 29) - 1)
void draw_flags(int num)
@Yepoleb
Yepoleb / aoc3.cpp
Last active December 3, 2018 23:19
#include <fstream>
#include <cassert>
#include <regex>
#include <string>
#include <vector>
#include <stddef.h>
#include <algorithm>
#include <fstream>
#include <cassert>
#include <string>
#include <iostream>
#include <vector>
#include <array>
constexpr int LABEL_LEN = 26;
int main()