Skip to content

Instantly share code, notes, and snippets.

View viruskizz's full-sized avatar
🎮
Relax

viruskizz viruskizz

🎮
Relax
View GitHub Profile
@viruskizz
viruskizz / 42Bangkok-vimrc.txt
Last active January 14, 2022 06:15
42Bangkok-vimrc
source $VIMRUNTIME/defaults.vim
set ts=4
set sw=4
set nu!
@viruskizz
viruskizz / 42Bangkok-vim-keys.txt
Last active January 14, 2022 06:15
42Bangkok-vim-useful-key
[h] Left
[j] Down
[k] UP
[l] Right
[w] Forward
[e] Forward to end word
[b] Backward
[0] start of line
[$] end of line
[gg] Go to Top file
@viruskizz
viruskizz / angular-json-to-xlsx.component.ts
Last active April 20, 2022 15:52
Angular export JSON to xlsx or any type
/**
* xlxs and file-saver example
* https://dev.to/idrisrampurawala/exporting-data-to-excel-and-csv-in-angular-3643
* https://github.com/SheetJS/sheetjs
* install library
* npm install --save xlsx file-saver
* npm i --save-dev @types/file-saver
*/
import { Component, OnInit } from '@angular/core';
import * as FileSaver from 'file-saver';
@viruskizz
viruskizz / basic-git-cmd.sh
Last active May 7, 2022 16:06
Basic git commands
## Get starting use git
# create git from empty
git init
# download project into your directory
git clone <url>
git clone <url> <dirname> #rename default project as you wish
## STATUS
# Check your git status
@viruskizz
viruskizz / 42Bangkok-push_swap_random_test.sh
Last active August 17, 2022 16:11
42Bangkok-push_swap random test
#!/bin/bash
## Setup
FILE="push_swap"
## Constant Variable
GREEN="\033[1;32m"
GRAY="\033[1;37m"
CYAN="\033[1;36m"
BLUE="\033[1;34m"
YELLOW="\033[1;33m"
@viruskizz
viruskizz / 42Bangkok-pushswap_test.sh
Last active August 17, 2022 14:19
42Bangkok-pushswap fully test
#!/bin/bash
## Setup
FILE="push_swap"
## Constant Variable
GREEN="\033[1;32m"
GRAY="\033[1;37m"
CYAN="\033[1;36m"
BLUE="\033[1;34m"
YELLOW="\033[1;33m"
@viruskizz
viruskizz / 42Bangkok-pushswap_checker_test.sh
Last active August 17, 2022 14:27
42Bangkok-pushswap checker test
#!/bin/bash
## Setup
FILE="checker"
## Constant Variable
GREEN="\033[1;32m"
GRAY="\033[1;37m"
CYAN="\033[1;36m"
BLUE="\033[1;34m"
YELLOW="\033[1;33m"
@viruskizz
viruskizz / get_next_line.c
Created September 29, 2022 03:01
42Exam-Rank03-get_next_line
#include <stdlib.h>
#include <unistd.h>
char *get_next_line(int fd)
{
if (BUFFER_SIZE < 1 || fd < 0 || read(fd, NULL, 0) < 0) { return (NULL); }
char *line = malloc(100000), *buf = line;
while (read(fd, buf, 1) > 0 && *buf++ != '\n');
return (buf > line) ? (*buf = 0, line) : (free(line), NULL);
}
@viruskizz
viruskizz / ft_printf.c
Last active November 22, 2022 15:34
42Exam-Rank03-ft_printf
#include <stdarg.h>
#include <unistd.h>
static int ft_put_base(int nb, char *range, int base, int *len)
{
if (nb < 0 && ++(*len))
return (write(1, "-", 1), ft_put_base(-nb, "0123456789", 10, len));
if (nb >= base)
ft_put_base(nb / base, range, base, len);
return (write(1, &range[nb % base], 1), ++(*len));
@viruskizz
viruskizz / 42Bangkok: minishell_testscript
Last active October 24, 2022 17:00
42Bangkok : Minishell interactive test script
Minishell test script
.
.**+**+=:.
*#********+=:..
:+**=:+###***++********+-.
=***###%#%##****++*********+:
-****###%%%%###******+*********+.
.+#***###%%%%%%#%%#****************=.
.++#***%#*#%%%%%#######****************: