This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <signal.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <unistd.h> | |
static void printSigset(sigset_t *set); | |
static void sigHandler(int); | |
int main(int argc, char **argv){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <FastLED.h> | |
#define LED_PIN 7 | |
#define NUM_LEDS 20 | |
CRGB leds[NUM_LEDS]; | |
void setup() { | |
FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS); | |
} | |
void loop() { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() { | |
// initialize digital pin 13 as an output. | |
pinMode(13, OUTPUT); | |
Serial.begin(9600); | |
} | |
// the loop function runs over and over again forever | |
void loop() { | |
String msg = ""; | |
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def decide_encoding(file_path): | |
try: | |
print("UTF-8") | |
f = open(file_path, 'r', encoding='utf-8') #ansi | |
txtdata = f.readlines() | |
return (True,"utf-9") | |
except: | |
try: | |
print("ANSI") | |
f = open(file_path, 'r', encoding='ansi') # ansi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
%matplotlib inline | |
np.random.seed(0) | |
# y=4X+6을 근사, 임의의 값을 노이즈로 만듬 | |
X=2*np.random.rand(100,1) | |
y=6+4*X+np.random.rand(100,1) | |
# X,y 데이터 세트 산점도로 시각화 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var arr = []; | |
for(i=1; i<11; i++){ | |
var keyName = "count"+i | |
var count = Math.floor(Math.random()*1000); | |
var obj = new Object(); | |
obj[keyName] = count; | |
arr.push(obj); | |
} | |
arr.forEach(function(value){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 버블 정렬 알고리즘 구현하기 | |
from typing import MutableSequence | |
def bubble_sort(a:MutableSequence)-> None: | |
'''버블 정렬''' | |
n=len(a) | |
for i in range(n-1): | |
for j in range(n-1,i,-1): | |
if a[j-1]>a[j]: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 고정 길이 스택 클래스 구현하기(collections.deque 사용) | |
from typing import Any | |
from collections import deque | |
class Stack: | |
def __init__(self,maxlen:int=256)-> None: | |
'''스택 초기화''' | |
self.capacity=maxlen | |
self.__stk =deque([],maxlen) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Node(object): | |
def __init__(self, value=None,pointer=None): | |
self.value=value | |
self.pointer=pointer | |
class Stack(object): | |
def __init__(self): | |
self.head=None | |
self.count=0 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Node(object): | |
def __init__(self,value=None, pointer=None): | |
self.value = value | |
self.pointer=None | |
class LinkedQueue(object): | |
def __init__(self): | |
self.head=None | |
self.tail=None | |
self.count=0 |