Skip to content

Instantly share code, notes, and snippets.

View Rockheung's full-sized avatar

Heung Jun Park Rockheung

View GitHub Profile
#!/usr/bin/env node
// simple console logger - drop some file and stdout
const fs = require("fs");
const path = require("path");
const http = require("http");
const time = new Date().getTime();
const logFilePath = path.join(__dirname, `log-${time}.txt`);
{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: clang++ build active file",
"command": "/usr/bin/clang++",
"args": [
"-std=c++17",
"-g",
{
"workbench.iconTheme": "vscode-icons",
"editor.fontFamily": "'JetBrains Mono', D2Coding, monospace",
// The number of spaces a tab is equal to. This setting is overridden
// based on the file contents when `editor.detectIndentation` is true.
"editor.tabSize": 2,
"[python]": {
"editor.tabSize": 4
},
// Insert spaces when pressing Tab. This setting is overriden
@Rockheung
Rockheung / ubuntu-efi32-wily.sh
Last active April 25, 2021 03:15
Modified Linuxium script to fix grub on efi32
#!/bin/sh
# Linuxium's installation script for booting from a 32-bit bootloader
chroot /target mount -t proc proc /proc
chroot /target mount -t sysfs sysfs /sys
mount --bind /dev /target/dev
mount --bind /run /target/run
chroot /target mount /dev/sda2 /boot/efi/
chroot /target apt-get -y purge grub-efi-amd64 grub-efi-amd64-bin grub-efi-amd64-signed
@Rockheung
Rockheung / MikroTik initializing script.md
Last active May 18, 2021 07:31
미크로틱 설정 스크립트 | MikroTik setting script

For RouterOS v6.42.4 (stable) in RB2011iL

UPNP

ip upnp interfaces add interface=bridge type=internal disabled=no
ip upnp interfaces add interface=ether1 disabled=no type=external
ip upnp set enabled=yes allow-disable-external-interface=yes show-dummy-rule=yes

Data Structure Chapter 3

연결 자료구조

  • 노드: [데이터][링크] - 링크는 다음 데이터의 주소
  • C에서는 포인터를 이용하여 구현한다고 보면 된다.

리스트 처음에 삽입

  1. 삽입할 노드(X)에 대한 메모리 할당받아 포인터 new에 주소 저장
  2. X의 데이터 필드에 데이터 저장

Data Structure Chapter 3

순차 자료구조

  • 순차 자료구조와 연결 자료구조의 비교
구분 순차 자료구조 연결 자료구조
메모리 저장 방식 논리순서에 맞추어 메모리에 빈틈없이 나열 논리순서에 따라 링크로 연결
연산 특징 삽입, 삭제 연산시에 비용이 선형으로 증가 삽입, 삭제 연산시에도 링크 정보만 변경

Data Structure Chapter 2 - recursion

  • 2-14, 재귀호출을 이용해 팩토리얼 값 구하기
#include <stdio.h>

long int fact(int);

int main() {

Data Structure Chapter 2 - Structure

구조체

  • 배열과 비슷하지만 각 구성요소의 타입을 명시해야
/* 사용1 */
struct employee {
    char name[10];
    int year;

Data Structure Chapter 2 - Pointer

포인터

  • 사용하는 모든 변수는 메모리의 특정 위치에 저장되는데, 그 위치를 나타내는 메모리의 주소를 포인터라고 한다!
/* 포인터 변수의 크기는 일반적으로 메모리 주소의 크기인 2바이트 */
/* 포인터 변수의 타입은 해당 포인터가 가리키는 데이이터 길이를 뜻한다고 볼 수 있다. */
/* 그러니까 액세스 범위를 뜻한다고도 할 수 있다. */