Skip to content

Instantly share code, notes, and snippets.

View dulimarta's full-sized avatar

Hans Dulimarta dulimarta

  • School of Computing and Information Systems, Grand Valley State University
  • Grand Rapids, Michigan
View GitHub Profile
@dulimarta
dulimarta / lab02_d.c
Last active January 29, 2016 15:32
CS452 Lab02 - Sample 4
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
int main(int argc, char* argv[])
{
if (argc < 2) {
fputs("Usage: must supply a command\n", stderr);
exit(1);
@dulimarta
dulimarta / lab03_a.c
Last active September 26, 2021 23:31
CS452 Lab03 - Sample 1
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <signal.h>
#include <errno.h>
#include <stdbool.h>
void sigHandler (int);
bool i_can_run = true;
@dulimarta
dulimarta / lab04_pipe_nodup.c
Last active February 9, 2024 01:52
CS452 Lab04 - Pipes - Sample 1
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <error.h>
#define READ 0
#define WRITE 1
#define MAX 1024
@dulimarta
dulimarta / Happy.java
Last active January 31, 2018 17:09
CS452 Thread Examples (.java, .c, .cpp)
public class Happy {
private static class HappyThread extends Thread {
private int limit;
public HappyThread(int N) {
this.limit = N;
}
public void run() {
try {
@dulimarta
dulimarta / arith_tester.cpp
Last active February 4, 2016 03:11
CS452 Program02 Files
#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include "gvpm.h"
#include "gv_eval.h"
/* In unit testing evaluate() must be invoked in immediate mode */
TEST_CASE ("SingleOperator", "alloperators") {
float res;
@dulimarta
dulimarta / lab04_a.c
Last active January 28, 2020 02:18
CS452 Lab04 - Sample 1
#include <pthread.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
/**
do_greeting prints a greeting message
both input argument (arg) and return value are an untyped pointer
@dulimarta
dulimarta / lab04_c.c
Created February 3, 2016 16:15
CS452 Lab04 - Sample 3
#include <pthread.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
void *do_greeting3(void *arg);
//arguments:arg is an untyped pointer pointing to a character
// returns:a pointer to NULL
@dulimarta
dulimarta / RandomNameApi.java
Created February 9, 2016 19:13
CS163 Lab - RandomNameApi
package edu.gvsu.cis.dulimarh.recyclerdemo;
import com.squareup.okhttp.OkHttpClient;
import retrofit.RestAdapter;
import retrofit.client.OkClient;
/**
* Created by Hans Dulimarta
*/
@dulimarta
dulimarta / RandomNameResults.java
Created February 9, 2016 19:29
CS163 Lab - RandomName: Result & User
package edu.gvsu.cis.dulimarh.recyclerdemo;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.List;
/**
* Created by Hans Dulimarta
*/
@dulimarta
dulimarta / lab05_a.c
Last active September 30, 2021 00:26
CS452 Lab05 - Sample 1
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#define FOO 4096
int main () {