Skip to content

Instantly share code, notes, and snippets.

View bzdgn's full-sized avatar
🏠
Working from home

Levent Divilioglu bzdgn

🏠
Working from home
View GitHub Profile
@bzdgn
bzdgn / starsHorizontal.html
Last active December 14, 2016 20:15
2D Horizontal Stars Oldskool Demo
<!DOCTYPE html>
<html>
<head>
<title>2D Horizontal Stars Oldskool Demo</title>
</head>
<body>
<canvas width="800" height="800" id="mainCanvas">
</canvas>
<p><input type="Button" VALUE=" start " onClick="doTimer()"></p>
<p><input type="Button" VALUE=" stop " onclick="stopTimer()"></p>
@bzdgn
bzdgn / multiCanvas.html
Created December 14, 2016 08:46
HTML5 Multi Canvas Example
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<!-- 3*x A4 -->
<!-- 630 891 -->
<canvas id="topCanvas" width="737" height="100" style="border:1px solid #d3d3d3;" onmouseover="mouseOver(this)" onmousedown="handleMouseClick(event)" onmouseup="handleMouseRelease(event)">
</canvas>
@bzdgn
bzdgn / stars.html
Last active December 14, 2016 20:15
2D Stars Demo with HTML5 Canvas
<!DOCTYPE html>
<html>
<head>
<title>Stars Oldskool Demo</title>
</head>
<body>
<canvas width="800" height="800" id="mainCanvas">
</canvas>
<p><input type="Button" VALUE=" start " onClick="doTimer()"></p>
<p><input type="Button" VALUE=" stop " onclick="stopTimer()"></p>
@bzdgn
bzdgn / MergeDemo.java
Created November 16, 2016 18:40
Demonstration of Merging K-Sorted Array With Unique Elements
package com.levo.odev;
/*
* En buyuk Fenerbahce!
*/
public class MergeDemo {
public static void main(String[] args) {
int[] arr1 = { 1, 2, 6, 7, 18, 19 };
int[] arr2 = { 3, 4, 5, 8, 9 };
@bzdgn
bzdgn / traverse.py
Created October 8, 2016 15:22
Python Samples
entries = [3, 2 , 'a', 'b' , 2 , 'c', 'd', 3, 'e', 'f', 'g']
numberOfEntries = entries[0]
i = 1;
elements = []
elIndex = 0
for index in range(numberOfEntries):
elements.append([])
@bzdgn
bzdgn / ExtDelegationPathExample.java
Created July 5, 2016 04:51
Java Extension Class Loader Path Example
package com.levo;
import java.net.URL;
import java.net.URLClassLoader;
public class ExtDelegationPathExample {
public static void main(String[] args) {
// ClassLoaders up to BootStrap;
// AppClassLoader
@bzdgn
bzdgn / ProducerConsumer.java
Last active May 10, 2016 02:32
A Producer/Consumer Example With Lock Object Using wait/notify methods
public class ProducerConsumer {
private static final int BUFFER_SIZE = 100;
private static final int PROCESS_SIZE = 1000000;
private static final int DIFF = 19;
private static Object lock = new Object();
private static int[] buffer;
private static int count;
@bzdgn
bzdgn / bitmapWriterV1.c
Created May 6, 2016 22:51
A Simple Bitmap Writer
// check struct for gcc pragma pop push;
// http://stackoverflow.com/questions/11129138/reading-writing-bmp-files-in-c
#include <stdio.h>
#include <stdint.h> // uint8_t, uint16_t
#include <stdlib.h> // malloc()
#include <string.h>
#define HALF 2 // HALF WORD 2 bytes
#define WORD 4 // WORD 4 bytes
@bzdgn
bzdgn / closestMultipleOfFour.c
Created May 6, 2016 21:44
Get The Closest Multiple Of Four Of An Integer
#include <stdio.h>
int closestMultipleOfFour(int num);
int main()
{
for(int i = 0; i < 20; i++)
printf("%2d : %2d\n", i, closestMultipleOfFour(i));
return 0;
@bzdgn
bzdgn / journal.cpp
Last active February 2, 2017 10:55
A Simple CPP Hello World For ofstream
#include <string>
#include <vector>
#include <fstream>
using namespace std;
struct Journal
{
string title;
vector<std::string> entries;