Skip to content

Instantly share code, notes, and snippets.

View RuRo's full-sized avatar

ruro RuRo

View GitHub Profile
@RuRo
RuRo / bread.c
Last active October 3, 2017 08:01
Simple `read()` wrapper for reading blocks without bothering with size checks.
// Requirements
//-----------------
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
//-----------------
// Reads a block of `count` bytes. If less than `count` bytes is available,
// fills the rest of `buf` with 0. Returns the number of bytes actually read.
@RuRo
RuRo / README.md
Last active January 16, 2024 06:40
Useful LaTeX presets for pretty printing code.

How to use code_presets.tex

  1. Create a new .tex file for your project.
  2. Copy %%-----DOCUMENT section into your file. Everything else will go into the $DOCUMENT CONTENTS HERE$ section.
  3. Select files, which you want to format. Currently supported formats are makefile, C code and README files.
    • Copy %%-----C, %%-----README or %%-----MAKEFILE section into your document.
    • Replace $FILE CONTENTS HERE$ with the contents of your file.
  4. Optional:
  • If you want your code sections to be labled with filenames, add a %%-----FILENAME section before the code section you are labeling. And replace $FILENAME HERE$ with full path to your file.
@RuRo
RuRo / logo-cmc.png
Last active November 25, 2017 12:46
Скелет работы по ЧМам (latex)
logo-cmc.png
import time
import functools
timers = {}
def timed(func):
global timers
timers[func] = {"T":0, "N":0}
@functools.wraps(func)
def wrapped(*args, **kwargs):
T = time.perf_counter()