Skip to content

Instantly share code, notes, and snippets.

View KennFatt's full-sized avatar
🌠
Stargazing

Kennan Fattahillah KennFatt

🌠
Stargazing
View GitHub Profile
@KennFatt
KennFatt / sdl_testcase.c
Last active July 16, 2019 18:27
SDL2 Sample.
#include <stdlib.h>
#include <stdio.h>
#include <SDL2/SDL.h>
/**
* I finally find out how this SDL should work on my machine.
* In the past, I just so dumb to not initialize its renderer.
*
* On this case, I create renderer and let it render the black screen with `SDL_SetRenderDrawColor`.
@KennFatt
KennFatt / distance_2p.c
Created July 10, 2019 00:26
algorithm: point of 2 point.
#include <stdio.h>
#include <math.h>
typedef struct {
int x;
int y;
} Vector2;
/**
* This is purely math, we also can apply this into 3 dimensional vector.
@KennFatt
KennFatt / c_stdint_mem_size.c
Created July 7, 2019 16:25
Wondering how stdint affect our memory management.
/**
* @author https://github.com/KennFatt
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
/**
* I've been do some research about C data type.
@KennFatt
KennFatt / unittest.c
Last active July 6, 2019 04:39
A unit testing to e3a171566309bd9be375965eb56216b1cc5ee78c
#include <SDL2/SDL.h>
#include <stdio.h>
#include "unittest.h"
#include "src/statemanager.h"
#include "src/graphics.h"
unsigned int onInit(void *state)
{
ce_State *P_state = (ce_State *) state;
fprintf(stderr, "[%p] Initialized...\n", (void *) P_state);
@KennFatt
KennFatt / runkt.sh
Created June 26, 2019 06:18
Kotlin compiler with bash environment. Helpful to use this as macro on your .bash_profile.
#!/bin/bash
function runkt() {
local kt_compiler=kotlinc
local c_params=$#
if [[ $c_params == 0 ]]; then
echo "[Run-KT] No parameters given!"
return
fi
@KennFatt
KennFatt / arch_installation.txt
Last active August 8, 2019 15:39
My Arch Linux installation guide. Originally written by myself and references from the internet.
Step to install Arch Linux:
1. Connect to the internet!
$ wifi-menu
2. Check if you are already connected to the internet.
$ ip addr show
$ ping www.google.com
3. Choose the right drive to install.
@KennFatt
KennFatt / .bash_aliases
Last active September 26, 2019 05:33
My favorite .bashrc appearance configuration.
#
# ~/.bash_aliases
#
## List of all my aliases.
# Supress systemctl as sudo.
alias systemctl='sudo systemctl'
# Common macros.
/**
* Leap year identifier.
* @author https://github.com/KennFatt
*
* KennFatt - 2019
*/
#include <stdio.h>
_Bool isLeapYear(int);
@KennFatt
KennFatt / route.php
Last active May 24, 2019 08:34
Simple routing system in PHP [Debug mode]
<?php
declare(strict_types=1);
use Closure;
class Router {
public function __construct() {
new class ($this, $_SERVER['REQUEST_URI'], function(string $msg) : string {
$len = strlen($msg);
@KennFatt
KennFatt / dep_resolve.php
Created April 19, 2019 12:46
Dependency Resolve Algorithm implementation in PHP
<?php
/**
* Algorithm by: Ferry Boender
* Source: https://www.electricmonk.nl/docs/dependency_resolving_algorithm/dependency_resolving_algorithm.html
*/
declare(strict_types=1);
class Node {