Skip to content

Instantly share code, notes, and snippets.

View lettergram's full-sized avatar
🕶️
Loading...

Austin Walters lettergram

🕶️
Loading...
View GitHub Profile
/**
* Given the file descriptor this function,
* writes A, waits 2 second, writes "c,"
*/
void child_one_func(int fd){
write(fd, "A - 1", 5);
sleep(2);
write(fd, "C - 3", 5);
close(fd);
int main(){
/**
* Create the epoll()
*
* From man pages
* Since Linux 2.6.8, the
* size argument is ignored,
* but must be greater than zero;
*/
int main(){
/* Create the kqueue() */
int kq = kqueue();
/* Double-array of fds for the pipe() */
int **fds = malloc(2 * sizeof(int *));
/* Create an array for the changelist and eventlist kevent structs */
struct kevent *evlist = malloc(sizeof(struct kevent));
void OpenBKZ::on_graphicsView_rubberBandChanged(const QRect &viewportRect, const QPointF &fromScenePoint, const QPointF &toScenePoint){
/* Code */
}
void OpenBKZ::on_graphicsView_rubberBandChanged(const QRect &viewportRect, const QPointF &fromScenePoint, const QPointF &toScenePoint){
/**
* fromScenePoint.y() & fromScenePoint.x() are zero upon release,
* I.E when the user has finished their highlighting.
*/
if(fromScenePoint.y() != 0 && toScenePoint.y() != 0){
this->start = toScenePoint.y();
this->end = fromScenePoint.y();
return;
searchWord(){
if(this->end_search < this->start_search){
int temp = this->start_search;
this->start_search = this->end_search;
this->end_search = temp;
}
this->start_search /= (this->fontsize / 2);
this->end_search /= (this->fontsize / 2);
errorAdjustment(QString line){
QString check(line);
int space = line.size() / (2 * fontsize);
line.remove(this->end_search + space, 85);
line.remove(0, this->start_search - space/2);
QStringList term = line.split(' ', QString::SkipEmptyParts);
QStringList words = check.split(' ', QString::SkipEmptyParts);
def LS(array):
sumxy = 0.0
sumx = 0.0
sumy = 0.0
sumxx = 0.0
x = 0
y = 1
int sock_fd = socket(AF_INET, SOCK_STREAM, 0);
struct addrinfo directives, *result;
memset(&directives, 0, sizeof(struct addrinfo));
directives.ai_family = AF_INET;
directives.ai_socktype = SOCK_STREAM;
directives.ai_flags = AI_PASSIVE;
/* Translates IP, port, protocal into struct */
if(0 != getaddrinfo(NULL, "8080", &directives, &result))
int sock_fd = socket(AF_INET, SOCK_STREAM, 0);
struct addrinfo info, *result;
memset(&info, 0, sizeof(struct addrinfo));
info.ai_family = AF_INET;
info.ai_socktype = SOCK_STREAM;
if(0 != getaddrinfo("localhost", "8080", &info, &result))
exit(1);