Skip to content

Instantly share code, notes, and snippets.

View stefafafan's full-sized avatar
👋

stefafafan stefafafan

👋
View GitHub Profile
@stefafafan
stefafafan / soundcloud-stream-revers.js
Last active July 14, 2020 14:28
Some Userscript to play soundcloud tracks in stream in reverse order
// ==UserScript==
// @name SoundCloud Stream Player
// @namespace https://stefafafan.hatenablog.com/
// @version 0.1
// @description play songs from the stream, in oldest to newest order.
// @author stefafafan
// @match https://soundcloud.com/stream
// @grant none
// ==/UserScript==
#include <iostream>
int main()
{
std::cout << "Hello, world!" << std::endl;
return 0;
}
@stefafafan
stefafafan / realloc
Created October 12, 2013 04:00
realloc implementation
void *realloc(void *ptr, size_t size)
{
char *p;
char *a = ptr;
// Realloc on a NULL pointer same as malloc.
if (ptr == NULL)
{
p = malloc(size);
return p;
@stefafafan
stefafafan / calloc
Created October 12, 2013 04:00
calloc implementation
void *calloc(size_t nmemb, size_t size)
{
char *p;
// If either is zero just return NULL.
if (nmemb == 0 || size == 0)
{
return NULL;
}
@stefafafan
stefafafan / free
Created October 12, 2013 03:58
free implementation
void free(void *p)
{
int size;
char *a;
a = (void *)p;
// Cannot free a NULL pointer.
if(p == NULL)
return;
@stefafafan
stefafafan / meh_malloc.c
Last active December 25, 2015 01:29
Some of my malloc implementation
#include <unistd.h> // for sbrk()
// Store free memory.
typedef struct free_list{
int size;
struct free_list *next;
struct free_list *before;
} *Free_list;
Free_list f = NULL;