Skip to content

Instantly share code, notes, and snippets.

View Lhy121125's full-sized avatar

Lhy121125

View GitHub Profile
@Lhy121125
Lhy121125 / http-server.c
Created December 24, 2022 19:33
http-server
#define _GNU_SOURCE
#include <arpa/inet.h>
#include <linux/limits.h>
#include <netdb.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/stat.h>
@Lhy121125
Lhy121125 / mdb-lookup-server.c
Last active December 25, 2022 20:05
Looking up the Keyword From Multiple Machines to the Server
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <mylist.h>
#include "mdb.h"
//#include "mdb.c"
#define KeyMax 5
#include <sys/types.h>
@Lhy121125
Lhy121125 / http-client.c
Created December 25, 2022 20:08
A http Client that Works Similar to wget
// Because we are using POSIX features that aren't part of the C standard, we
// need to #define this macro before #including standard library headers to be
// granted access to POSIX-specific definitions such as struct addrinfo.
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@Lhy121125
Lhy121125 / cky.py
Created December 25, 2022 20:09
Implementation of CKY Algorithm for NLP
"""
COMS W4705 - Natural Language Processing
Homework 2 - Parsing with Probabilistic Context Free Grammars
Nick Luo
"""
from lib2to3.pgen2 import token
import math
import sys
from collections import defaultdict
import itertools
@Lhy121125
Lhy121125 / SentAnalysis.java
Created December 25, 2022 20:13
AI Algorithm for Sentiment Analysis
/*
* SentAnalysis.java
* Ray Zeng(Tianrui) & Nick Luo(Haiyu)
* All group members were present and contributing during all work on this project.
* We have neither received nor given any unauthorized aid in this assignment.
*/
package hw4;
/*
* Please see submission instructions for what to write here.
*/
@Lhy121125
Lhy121125 / main.cpp
Created December 30, 2022 02:41
Mesh Simplification With Flux
#include "element.h"
#include "linear_algebra.h"
#include "mat.hpp"
#include "mesh.h"
#include "sphere.h"
#include "readwrite.h"
#include "simplifier.h"
#include "vec.hpp"
#include "webgl.h"
#include <map>
@Lhy121125
Lhy121125 / trigram_model.py
Created January 20, 2023 19:27
Implementation of Trigram Model
import sys
from collections import defaultdict
import math
import random
import os
import os.path
"""
COMS W4705 - Natural Language Processing - Fall 2022
Prorgramming Homework 1 - Trigram Language Models
Nick Luo
@Lhy121125
Lhy121125 / extract_training_data.py
Created January 20, 2023 19:31
Extracting Data for the Dependency Parsing Tree
from conll_reader import DependencyStructure, conll_reader
from collections import defaultdict
import copy
import sys
import keras
import numpy as np
class State(object):
def __init__(self, sentence = []):
self.stack = []
@Lhy121125
Lhy121125 / decoder.py
Created January 20, 2023 19:32
Implementation of Decoder of Dependency Parse Tree
from conll_reader import DependencyStructure, DependencyEdge, conll_reader
from collections import defaultdict
import copy
import sys
import numpy as np
import keras
import tensorflow as tf
from extract_training_data import FeatureExtractor, State
@Lhy121125
Lhy121125 / multi-server.c
Last active February 18, 2023 16:35
A http server that allows client to connect to multiple ports concurrently
/*
* multi-server.c
*/
#include <stdio.h> /* for printf() and fprintf() */
#include <sys/socket.h> /* for socket(), bind(), and connect() */
#include <arpa/inet.h> /* for sockaddr_in and inet_ntoa() */
#include <stdlib.h> /* for atoi() and exit() */
#include <string.h> /* for memset() */
#include <unistd.h> /* for close() */