Instantly share code, notes, and snippets.

Arkadiusz Drabczyk ardrabczyk

View GitHub Profile
@ardrabczyk
ardrabczyk / triangle.c
Last active Jan 23, 2019
Character triangle
View triangle.c
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int chars_in_line = 7;
char current_letter = 65; /* ASCII A */
int current_chars_in_line = chars_in_line;
for(int i = 0; i < chars_in_line; i++)
View test.md
var user = "string"
var user = "string"
@ardrabczyk
ardrabczyk / linked-list.c
Created Jan 2, 2017
Single linked-list implementation in C
View linked-list.c
/* ## (c) 2017, Arkadiusz Drabczyk, arkadiusz@drabczyk.org */
#include <stdio.h>
#include <stdlib.h>
struct node {
int data;
struct node *next;
};
@ardrabczyk
ardrabczyk / vb.sh
Last active Feb 18, 2016
vb.sh: create a new virtualbox machine
View vb.sh
#!/usr/bin/env sh
# vb.sh: create a new virtualbox machine
#
## (c) 2016, Arkadiusz Drabczyk, arkadiusz@drabczyk.org
if [ "$#" -lt 2 ]
then
echo Usage: "$0" \<MACHINE-NAME\> \<ISO\> [RAM] [DISK] [TYPE]
echo Example:
echo ./vb.sh \"Slackware x64 14.1\" slackware64-14.1-install-dvd.iso
@ardrabczyk
ardrabczyk / main.c
Created Sep 30, 2015
Extract bits from byte stream
View main.c
#include <stdio.h>
#include <stdlib.h>
/*
Starting at position <position> extract <length> older bits.
Example:
bit number:
7 6 5 4 3 2 1 0 | 15 14 13 12 11 10 9 8 | 23 22 21 20 19 18 17 16
@ardrabczyk
ardrabczyk / insertion_sort.c
Created Sep 14, 2015
Insertion sort implementation in C
View insertion_sort.c
#include <stdio.h>
#include <stdlib.h>
void print(int arr[], size_t size)
{
unsigned i = 0;
for (; i < size; ++i)
{
printf("%d ", arr[i]);
}
@ardrabczyk
ardrabczyk / bubble-sort.c
Last active Sep 3, 2015
Bubble sort implementation in C using do...while loop
View bubble-sort.c
#include <stdio.h>
#include <stdlib.h>
void bubble(int arr[], size_t size)
{
int i = 0;
int temp;
int again = 1;
int iter = size - 1;
@ardrabczyk
ardrabczyk / stack.c
Created Sep 1, 2015
C stack implementation
View stack.c
#include <stdio.h>
#include <stdlib.h>
#define _E(msg, args...) \
do{ \
printf( "[ERROR][%s][%d]: ", __FUNCTION__, __LINE__); \
printf( (msg), ##args); \
}while(0)
struct stack