Skip to content

Instantly share code, notes, and snippets.

View ROCKYANEW's full-sized avatar

RAKU ROCKYANEW

View GitHub Profile
weight = float(input("Enter weight in pounds: "))
payment = float(input("Enter payment in dollars: "))
cost = (2.5 * weight)
if payment >= cost:
change = payment - cost
print("Your change is ${0:,.2f}.".format(change))
else:
amountOwed = cost - payment
print("You owe ${0:,.2f} more.".format(amountOwed))
class Contact:
def __init__(self, name, phone_number, e_mail, addr):
self.name = name
self.phone_number = phone_number
self.e_mail = e_mail
self.addr = addr
def print_info(self):
print("Name: ", self.name)
print("Phone Number: ", self.phone_number)
#include <stdio.h>
int N; // 계단의 개수
int P[310]; // P[i]: i 계단을 밟았을 때 얻는 점수
int Dp[310];
int max(int a, int b){
return a > b ? a : b;
}
// dev.c
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/fs.h>
// Character Device Driver 작성 방법
// 1. 드라이버 등록 함수
// - register_chrdev
// 2. 드라이버 제거 함수
// dev.c
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/fs.h>
// Character Device Driver 작성 방법
// 1. 드라이버 등록 함수
// - register_chrdev
// 2. 드라이버 제거 함수
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/vmalloc.h>
MODULE_LICENSE("GPL");
// vmalloc: 만약 물리적으로 연속적일 필요가 없는
// 큰 메모리가 필요하다.
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/gfp.h>
#include <linux/slab.h>
MODULE_LICENSE("GPL");
// 자주 사용하는 구조체를 slab 을 통해 등록해서 사용하고 싶다.
// 1. kmem_cache_create: cache 생성
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/gfp.h>
#include <linux/slab.h>
MODULE_LICENSE("GPL");
// 동적 메모리 할당 => 실행 시간에 메모리를 할당하고, 해지하기 위해
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/gfp.h>
MODULE_LICENSE("GPL");
// 동적 메모리 할당 => 실행 시간에 메모리를 할당하고, 해지하기 위해
// 1. buddy
// 페이지 단위 메모리 할당
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/workqueue.h>
// 인터럽트의 컨텍스트는 최대한 빨리 리턴되는 것이 중요하다.
// 두 부분으로 나누어서 처리한다.