Skip to content

Instantly share code, notes, and snippets.

@uhmseohun
uhmseohun / socket_select_function.c
Created May 28, 2021 06:05
socket_select_function
socket1 = Socket()
socket2 = Socket()
FD_ZERO(&read);
while (1) {
FD_SET(socket1, &read);
FD_SET(socket2, &read);
state = select(maxfd+1, &read, 0, 0, 0);
switch (state) {
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Aliens Abducted Me - Report an Abduction</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
#include <cstdio>
#include <set>
using namespace std;
const int _size = 100005;
int n, k, m[_size];
multiset<int> s;
int get_minmax(multiset<int> s) {
return (*s.begin()) * (*s.rbegin());
}
#include <stdio.h>
#include <stdlib.h>
#define QUEUE_SIZE 5
typedef char element;
typedef struct {
element queue[QUEUE_SIZE];
int front, rear;
} QueueType;
#include <stdio.h>
#include <stdlib.h>
#define QUEUE_SIZE 5
typedef char element;
typedef struct {
element queue[QUEUE_SIZE];
int front, rear;
} QueueType;
#include <stdio.h>
#include <stdlib.h>
#define QUEUE_SIZE 10
typedef char element;
typedef struct {
element queue[QUEUE_SIZE];
int front, rear;
} QueueType;
#include <stdio.h>
#include <stdlib.h>
#define STACK_SIZE 10
char stack[STACK_SIZE];
int top = -1;
int isFull() {
return top >= STACK_SIZE - 1;
}
#include <iostream>
#include <set>
#include <string>
using namespace std;
set <int> s;
void push () {
int val;
cin >> val;
if (s.insert(val).second)
@uhmseohun
uhmseohun / simple_mnist.py
Created April 6, 2020 08:00
간단한 MNIST 예제
import numpy as np
import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Flatten, Dense, Activation
def softmax(x):
return np.exp(x) / np.sum(np.exp(x), axis=0)
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()
x_train = x_train.astype('float32')
@uhmseohun
uhmseohun / set.cpp
Created December 11, 2019 03:00
수학 집합 단원
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <algorithm>
using namespace std;
const int maxSize = 150; // The maximum number of elements
const int boundSize = 50;