Skip to content

Instantly share code, notes, and snippets.

View mijaros's full-sized avatar

Miroslav Jaroš mijaros

View GitHub Profile

Keybase proof

I hereby claim:

  • I am mijaros on github.
  • I am mijaros (https://keybase.io/mijaros) on keybase.
  • I have a public key whose fingerprint is 8B66 3D3B 7B38 FC89 D145 9CF8 0AD2 06A1 1BC2 70DB

To claim this, I am signing this object:

Logger for c language

This repository provides a simple logger for C language.

The logger.h header file provides simple compile-time logger utility which could be used for logging messages syslog compatible logging levels.

The example code of usage can be found in the example.c file.

#include <string.h>
#include <stdio.h>
struct test {
char a[1024];
};
int main(void)
{
struct test arr[20] = {
@mijaros
mijaros / sorters.go
Last active December 11, 2017 19:01
package sortingAlgorithms
type Sortable interface {
Len() int
Less(i, j int) bool
Swap(i, j int)
}
type SortingFunc func(Sortable) Sortable
#include "io.h"
#include "iotxt.h"
char *readLine(FILE *file)
{
if (!file) {
return NULL;
}
size_t buffer_size = 1;
#include <stdio.h>
#define ARRAY_5(B) {B, B, B, B, B}
#define ARRAY_3(B) {B, B, B}
#define FILL_ARRAY(MA, VAL) MA(VAL)
#define print_arr(type, variable, generator, value) \
do { \
type variable[] = FILL_ARRAY(generator, value); \
for (size_t i = 0; i < sizeof variable/sizeof(*variable); i++) { \
#include <stdlib.h>
#include <stdio.h>
void test(char data[255])
{
printf("%s\n", data);
}
int main(void)
{
#!/usr/bin/env python3
class node:
def __init__(self, number):
self.number = number
self.neighbors = []
self.has_agent = False
def add_path(self, other_node):
self.neighbors.append(other_node)
[root@rhel-slave-01 ~]# date && ping apiman.io -c 3 && date
Tue Jun 14 07:37:30 EDT 2016
PING apiman.io (174.129.25.170) 56(84) bytes of data.
64 bytes from 174.129.25.170: icmp_seq=1 ttl=33 time=12.9 ms
64 bytes from wwwizer.com (174.129.25.170): icmp_seq=2 ttl=33 time=18.0 ms
64 bytes from wwwizer.com (174.129.25.170): icmp_seq=3 ttl=33 time=15.7 ms
--- apiman.io ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 27062ms
rtt min/avg/max/mdev = 12.914/15.571/18.050/2.105 ms
@mijaros
mijaros / expected.xml
Last active June 1, 2016 15:06
JSON --> XML
<?xml version="1.0"?>
<root>
<attr1>val1</attr1>
<attr2>val2</attr2>
</root>