Skip to content

Instantly share code, notes, and snippets.

View JeonghunLee's full-sized avatar
๐Ÿค—
I may be slow to respond.

JeongHun (James) Lee JeonghunLee

๐Ÿค—
I may be slow to respond.
View GitHub Profile
#include <stdio.h>
#define CNT_TEST 2
int map[20]={0}; // save address info
int size=0;
int map2[20]={0}; // save address info
int size2=0;
#include <stdio.h>
#include <stdlib.h>
typedef struct sListElemt_{
int data;
struct sListElemt_ *next ;
}sListElemt;
typedef struct sList_{
int size;
#include <stdio.h>
int *aa[10]={0};
int (*bb)[10]={0};
int cc[10];
/*
Output
*aa[10]=40 byte (*bb)[10]=4 byte cc[10]=40 byte
*/
#include <stdio.h>
#include <string.h>
#define MAX_HASH 20
#define HASH_KEY 0
#define HASH_VAL 1
static int hashmap[MAX_HASH][2]={0}; // open-addressing hash, pointer
static int hashsize=0;
#include <stdio.h>
/*
refer to
https://en.wikipedia.org/wiki/Breadth-first_search
*/
#define MAX_VERTEX 30
int visit[MAX_VERTEX]={0};
int map[MAX_VERTEX][MAX_VERTEX]={0};
#include <stdio.h>
#define MAX 50
int a[] = { 99, 11, 29, 44, 17, 55, 63, 05, 22, 42, 15, 12 ,21 };
int b[MAX];
int merge_merging(int src[], int dst[], int start, int mid, int end)
{
#include <stdio.h>
//http://stackoverflow.com/questions/101439/the-most-efficient-way-to-implement-an-integer-based-power-function-powint-int
/*
all exponential values (e.g.5) was chaged to 2 system
* check even or odd
<----------------------->
2^3 2^2 2^1 2^0
0b 1 0 1 0 : 10
/*
ย  Refer to https://github.com/meyerd/flex-bison-example
ย  Definitions
C์ฝ”๋“œ ์‚ฝ์ž…์‹œ %{, }% ๊ธฐํ˜ธ
*/
%option noyywrap // flex
%{
#include <stdio.h>
@JeonghunLee
JeonghunLee / gist:7f702a8729751cfa8186c0df677ff552
Created August 18, 2017 15:01 — forked from ihoneymon/how-to-write-by-markdown.md
๋งˆํฌ๋‹ค์šด ์‚ฌ์šฉ๋ฒ•

[๊ณตํ†ต] ๋งˆํฌ๋‹ค์šด markdown ์ž‘์„ฑ๋ฒ•

1. ๋งˆํฌ๋‹ค์šด์— ๊ด€ํ•˜์—ฌ

1.1. ๋งˆํฌ๋‹ค์šด์ด๋ž€?

**Markdown**์€ ํ…์ŠคํŠธ ๊ธฐ๋ฐ˜์˜ ๋งˆํฌ์—…์–ธ์–ด๋กœ 2004๋…„ ์กด๊ทธ๋ฃจ๋ฒ„์— ์˜ํ•ด ๋งŒ๋“ค์–ด์กŒ์œผ๋ฉฐ ์‰ฝ๊ฒŒ ์“ฐ๊ณ  ์ฝ์„ ์ˆ˜ ์žˆ์œผ๋ฉฐ HTML๋กœ ๋ณ€ํ™˜์ด ๊ฐ€๋Šฅํ•˜๋‹ค. ํŠน์ˆ˜๊ธฐํ˜ธ์™€ ๋ฌธ์ž๋ฅผ ์ด์šฉํ•œ ๋งค์šฐ ๊ฐ„๋‹จํ•œ ๊ตฌ์กฐ์˜ ๋ฌธ๋ฒ•์„ ์‚ฌ์šฉํ•˜์—ฌ ์›น์—์„œ๋„ ๋ณด๋‹ค ๋น ๋ฅด๊ฒŒ ์ปจํ…์ธ ๋ฅผ ์ž‘์„ฑํ•˜๊ณ  ๋ณด๋‹ค ์ง๊ด€์ ์œผ๋กœ ์ธ์‹ํ•  ์ˆ˜ ์žˆ๋‹ค. ๋งˆํฌ๋‹ค์šด์ด ์ตœ๊ทผ ๊ฐ๊ด‘๋ฐ›๊ธฐ ์‹œ์ž‘ํ•œ ์ด์œ ๋Š” ๊นƒํ—™(https://github.com) ๋•๋ถ„์ด๋‹ค. ๊นƒํ—™์˜ ์ €์žฅ์†ŒRepository์— ๊ด€ํ•œ ์ •๋ณด๋ฅผ ๊ธฐ๋กํ•˜๋Š” README.md๋Š” ๊นƒํ—™์„ ์‚ฌ์šฉํ•˜๋Š” ์‚ฌ๋žŒ์ด๋ผ๋ฉด ๋ˆ„๊ตฌ๋‚˜ ๊ฐ€์žฅ ๋จผ์ € ์ ‘ํ•˜๊ฒŒ ๋˜๋Š” ๋งˆํฌ๋‹ค์šด ๋ฌธ์„œ์˜€๋‹ค. ๋งˆํฌ๋‹ค์šด์„ ํ†ตํ•ด์„œ ์„ค์น˜๋ฐฉ๋ฒ•, ์†Œ์Šค์ฝ”๋“œ ์„ค๋ช…, ์ด์Šˆ ๋“ฑ์„ ๊ฐ„๋‹จํ•˜๊ฒŒ ๊ธฐ๋กํ•˜๊ณ  ๊ฐ€๋…์„ฑ์„ ๋†’์ผ ์ˆ˜ ์žˆ๋‹ค๋Š” ๊ฐ•์ ์ด ๋ถ€๊ฐ๋˜๋ฉด์„œ ์ ์  ์—ฌ๋Ÿฌ ๊ณณ์œผ๋กœ ํผ์ ธ๊ฐ€๊ฒŒ ๋œ๋‹ค.

1.2. ๋งˆํฌ๋‹ค์šด์˜ ์žฅ-๋‹จ์ 

1.2.1. ์žฅ์ 

1. Execute make first. This will result in a netlinkKernel.ko output among many others.
2. Execute $ gcc netlinkUser.c -o netlinkUser
3. Insert kernel module by :$ sudo insmod netlinkKernel.ko
4. Run ./netlinkUser to see message and run dmesg to see debug messages
5. Remove module by : $ sudo rmmod netlinkKernel
6. Finally make clean to remove output files.