Skip to content

Instantly share code, notes, and snippets.

View ixn's full-sized avatar

IXn Muhammad ixn

View GitHub Profile
@ixn
ixn / index.html
Created October 3, 2014 00:46
html kalkulator
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>evhttp_server_test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<!-- This example create a webpage asking for a username and a password then send it to a specified address. -->
<form id="contact" method="post" action="http://127.0.0.1:8080">
<fieldset><legend>Kalkulator</legend>
@ixn
ixn / server_kalkulator.c
Created October 3, 2014 01:14
Proses server_kalkulator
/* Contoh Sederhana Penggunaan Libevent untuk membuat server kalkulator
*yang di input/output menggunakan HTML
created by http://deeprhezy.tumblr.com
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
CC=gcc
CFLAGS=-I.
all: server_kalkulator
server_kalkulator: server_kalkulator.c
$(CC) $(CFLAGS) -o server_kalkulator $^ -L/usr/local/lib -levent -lm $(LDFLAGS)
clean:
rm -f *.o
rm -f *~
rm -f server_kalkulator
@ixn
ixn / hello-world.c
Last active August 29, 2015 14:07
Hello World in C use Libevent
/*
This exmple program provides a trivial server program that listens for TCP
connections on port 9995. When they arrive, it writes a short message to
each client connection, and closes each connection once it is flushed.
Where possible, it exits cleanly in response to a SIGINT (ctrl-c).
*/
/* Deklarasi lib standar yang digunakan */
#include <string.h>
@ixn
ixn / object.c
Created October 25, 2014 11:01
Simple object oriented in C (http://deeprhezy.tumblr.com)
#include "object.h"
int
main(int argc, char* argv[])
{
/* Deklarasi obj sebagai object */
object* obj;
@ixn
ixn / object.h
Created October 25, 2014 11:02
Simple object oriented in C (http://deeprhezy.tumblr.com)
#ifndef __OBJECT_H__
#define __OBJECT_H__
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* membuat pengelompokan data dengan struct
kita beri nama object yang berisi (object1 & object2)
@ixn
ixn / fungsiobj.c
Created October 25, 2014 11:03
Simple object oriented in C (http://deeprhezy.tumblr.com)
#include "object.h"
/* Melakukan pengalokasian memory, menggunakan calloc
Saat menggunakan fungsi ini direkomendasikan untuk
menghapus kembali memory menggunakan object_free()
*/
object*
object_new(void){
@ixn
ixn / Makefile
Created October 25, 2014 11:03
Simple object oriented in C (http://deeprhezy.tumblr.com)
CC=gcc
CFLAGS=-I.
LDFLAGS=
FUNGSIOBJ = object.c\
fungsiobj.c
all:object
@ixn
ixn / Makefile
Created October 25, 2014 11:12
Simple object oriented in C (http://deeprhezy.tumblr.com)
CC=gcc
CFLAGS=-I.
LDFLAGS=
FUNGSIOBJ = object.c\
fungsiobj.c
all:object
@ixn
ixn / penjumlahan.c
Last active January 22, 2017 00:26
Contoh sangat sederhana enkapsulasi data dengan c
/*
contoh sangat sederhana enkapsulasi data dengan c
more: https://deeprhezy.trumblr.com
compile: gcc -o penjumlahan penjumlahan.c internal_api.c
*/
#include "internal_api.h"
int