Skip to content

Instantly share code, notes, and snippets.

@shinaisan
shinaisan / main.c
Created April 7, 2012 04:09
Win32 sample program of bitmap waving effect
// To compile (using VC):
// cl main.c /link gdi32.lib user32.lib kernel32.lib
#include <tchar.h>
#include <math.h>
#include <windows.h>
TCHAR *szWindowClass =_T("Window Class Name");
#define PI 3.14159265
@shinaisan
shinaisan / index.html
Created April 15, 2012 06:06
Processing.js sample: dragging a circle(ellipse) using mousePressed/mouseReleased.
<html>
<head>
<title>My first processing.js sample</title>
<script type="text/javascript" src="processing.js"></script>
</head>
<body>
<h1>Sample: Dragging the ball</h1>
<script type="application/processing" src="test.processing"></script><canvas></canvas>
<br/>
Useless:)
@shinaisan
shinaisan / index.html
Created April 30, 2012 12:51
Comparison of random and noise in processing.js
<html>
<head>
<title>Comparison of random and noise in processing.js</title>
<script type="text/javascript" src="processing.js"></script>
</head>
<body>
<h1>random (upper) and noise (lower)</h1>
<script type="application/processing" src="test.processing"></script><canvas></canvas>
<br/>
Useless:)
@shinaisan
shinaisan / index.html
Created May 29, 2012 12:52
An illustration of a proof of Pythagorean theorem using Processing.js
<html>
<head>
<title>An illustration of a proof of Pythagorean theorem using Processing.js</title>
<script type="text/javascript" src="processing.js"></script>
</head>
<body>
<h1>An illustration of a proof of Pythagorean theorem using Processing.js</h1>
Drag the point C:<br/>
<script type="application/processing" src="pythagorean.processing"></script><canvas></canvas>
<br/>
@shinaisan
shinaisan / bw.processing
Created June 23, 2012 13:56
Bezier Worm
/* -*- mode: java; indent-tabs-mode; nil -*- */
/*
* Inspired by the great book "Processing: Creative Coding and Computational Art" by Ira Greenberg.
*/
int canvasWidth = 500;
int canvasHeight = 500;
int graphWidth = canvasWidth - 40;
int graphHeight = 200;
@shinaisan
shinaisan / foxtail.processing
Created June 23, 2012 14:34
Foxtail Grass in Processing.js
/* -*- mode: java; indent-tabs-mode; nil -*- */
int canvasWidth = 500;
int canvasHeight = 500;
ControlPoint[] controlPoints;
CheckBox chkShowControlPoints;
Setaria setaria;
void setup() {
@shinaisan
shinaisan / pegen.c
Created July 10, 2012 14:03
Example generation of a PE file targeted for Windows CE/MIPS.
/* Example generation of a PE file targeted for Windows CE/MIPS. */
/* To build w/ MSVC: cl pegen.c */
/* To generate a PE: pegen <arbitrary_number> <output_file_name.exe> */
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
typedef uint32_t inst_t;
@shinaisan
shinaisan / pegen.c
Created July 10, 2012 14:13
Example generation of a PE file targeted for Windows CE/MIPS. (getchar() -> MessageBoxW())
/* Example generation of a PE file targeted for Windows CE/MIPS. (getchar() -> MessageBoxW()) */
/* To build w/ MSVC: cl pegen.c */
/* To generate a PE: pegen <arbitrary_number> <output_file_name.exe> */
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
typedef uint32_t inst_t;
@shinaisan
shinaisan / pegen.c
Created July 10, 2012 14:29
Example generation of a PE file targeted for Windows CE/MIPS. (getchar() -> MessageBoxW() -> putchar())
/* Example generation of a PE file targeted for Windows CE/MIPS. (getchar() -> MessageBoxW() -> putchar()) */
/* To build w/ MSVC: cl pegen.c */
/* To generate a PE: pegen <arbitrary_number> <output_file_name.exe> */
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
typedef uint32_t inst_t;
@shinaisan
shinaisan / test.c
Created August 6, 2012 14:55
C program that analyzes a constant pool in a Java class file and prints out its contents.
/* -*- mode: c; coding: utf-8-dos; indent-tabs-mode: nil; c-basic-offset: 4 */
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stddef.h>
#include <limits.h>
#include <arpa/inet.h>
#pragma pack(1)