Skip to content

Instantly share code, notes, and snippets.

View AdrianSkar's full-sized avatar
:octocat:

Adrian Skar AdrianSkar

:octocat:
View GitHub Profile
@AdrianSkar
AdrianSkar / trakt-backup.php
Created January 22, 2022 16:25 — forked from darekkay/trakt-backup.php
Trakt.tv backup script
<?php
/*
Backup script for trakt.tv (API v2).
Live demo: https://darekkay.com/blog/trakt-tv-backup/
*/
// create a Trakt app to get a client API key: http://docs.trakt.apiary.io/#introduction/create-an-app
$apikey = "CLIENT_API_KEY";
@AdrianSkar
AdrianSkar / rev-names.js
Created October 16, 2022 15:39
reversed and sortered Array of names
const people = [
'Bernhard, Sandra',
'Bethea, Erin',
'Becker, Carl',
'Bentsen, Lloyd',
'Beckett, Samuel',
'Blake, William',
'Berger, Ric',
'Beddoes, Mick',
'Beethoven, Ludwig',
@AdrianSkar
AdrianSkar / c-bubble-sort.c
Last active May 9, 2024 11:55
bubble sort in C
# include <stdio.h>
// bubble sort example
void ft_sort_arr(int *arr, int size)
{
int passes = 0; // number of passes
int j; // index of the array
int temp; // temporary variable to store the value of the array
int swap_count = -1; // number of swaps in each pass, -1 to enter the loop
@AdrianSkar
AdrianSkar / c-selection-sort.c
Created May 9, 2024 16:30
selection sort in C
# include <stdio.h>
// selection sort example
void ft_ssort_arr(int *arr, int size)
{
int i = 0, j; // arr indexes
int min; // index of the minimum value
int temp; // temporary variable to store the value of the array
while (i < size-1) // arr iter
@AdrianSkar
AdrianSkar / main.c
Last active June 20, 2024 14:09
[GNL]: main for printf segfault on EOF
#include "get_next_line.h"
#include <stdio.h> // printf
#include <fcntl.h> // open, O_RDONLY, O_WRONLY, O_RDWR,
int main(void)
{
int gnl_calls = 3, fd, i;
char *line;
fd = open("test.txt", O_RDONLY);
@AdrianSkar
AdrianSkar / test_exam2_first_word.c
Created November 1, 2024 15:03
Testing exam exercise, ./a.out " " returns USER=username
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdint.h>
#include <stdarg.h>
/*
Assignment name : first_word
Expected files : first_word.c