Skip to content

Instantly share code, notes, and snippets.

View hanjae-jea's full-sized avatar

Hanjae hanjae-jea

View GitHub Profile
@hanjae-jea
hanjae-jea / hi.cpp
Last active May 28, 2017 09:45
calloc
#include <stdio.h>
#include <stdlib.h>
// to make chart[100][1000] in function
void main()
{
int **chart = (int**)calloc(100, sizeof(int*));
for (int i = 0; i < 100; i++) {
chart[i] = (int*)calloc(1000, sizeof(int));
}
@hanjae-jea
hanjae-jea / 0829.cpp
Last active August 30, 2017 03:32
0829.cpp
#include <CoDrone.h>
int mode = 0; // 0 none 1 start 2 running
int index = 0, fly = 0;
int throttleCount = 0;
int yy[800], tt[800], rr[800], pp[800];
void setup() {
CoDrone.begin(115200);
@hanjae-jea
hanjae-jea / CoDrone.cpp
Created September 13, 2017 12:13
코드론
#include <CoDrone.h>
void setup(){
CoDrone.begin(115200);
CoDrone.AutoConnect(NearbyDrone);
CoDrone.FlightEvent(TakeOff);
PITCH = 60;
CoDrone.Control();
delay(1500);
PITCH = 0;
@hanjae-jea
hanjae-jea / mopa.py
Created December 17, 2017 16:59
mopa
def args_func(first, second, *args, **kwargs):
print("first: ", first)
print("second: ", second)
for arg in args:
print("*argv 인자 ", arg)
for key, value in kwargs.items():
print("*kwargs %s -> %s" % (key, value))
args_func(5, "구구", 12,34,56,ff=99,name="HJ",club="catdog")
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef struct student {
int id;
char name[20];
student *next;
}student;
int main() {
// 예제 1
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
//student 구조체 정의
typedef struct student {
char name[100]; //이름
@hanjae-jea
hanjae-jea / ans.cpp
Created June 1, 2018 12:17
제한재 선생님 답변
/* // 1번
#include <stdio.h>
int arr[105][105] = {0,}; // 배열 크기는 넉넉하게 0으로 초기화
int main(void)
{
int n, m;
scanf("%d %d", &n, &m); // 입력
#include <stdio.h>
#include <stdlib.h>
typedef struct node{
char value;
struct node* parent;
struct node* left, *right;
}node;
typedef node* p_node;
void inorder(p_node node){
#include <stdio.h>
char inp[100];
char st[100];
int top = 0;
void push(char c){
st[top++] = c;
}
char pop(){
if( top == 0 ) return -1;
return st[--top];
import serial #Serial imported for Serial communication
import time #Required to use delay functions
ArduinoSerial = serial.Serial('/dev/cu.usbmodem1421',9600) #Create Serial port object called arduinoSerialData
time.sleep(2) #wait for 2 secounds for the communication to get established
print (ArduinoSerial.readline()) #read the serial data and print it as line
print ("Enter 1 to turn ON LED and 0 to turn OFF LED")