Skip to content

Instantly share code, notes, and snippets.

View mingyc's full-sized avatar

Ming-Ying Chung mingyc

  • Tokyo, Japan
  • 14:00 (UTC +09:00)
View GitHub Profile
@mingyc
mingyc / property.py
Created March 22, 2012 11:12
Example of the usage of built-in property() function.
class Circle(object):
def __init__(self, radius):
self._radius = radius
def _get_radius(self):
return self._radius
def _set_radius(self, value):
self._radius = value
def _del_radius(self):
del self._radius
@mingyc
mingyc / io.c
Created March 22, 2012 06:05
A buggy program that won't work on Windows but work on Un*x-like system
#include <stdio.h>
int main()
{
int i;
char strings[4][8];
for (i = 3; i >= 0; i--)
scanf("%s", strings[i]);
#include <stdio.h>
#include <math.h>
#define MAX 1000010
int prime[MAX] = {0};
void make_prime();
int reverse(int);
int main()
{
int n;
make_prime();
@mingyc
mingyc / xls-traversal.py
Created February 9, 2012 14:39
A sample code that traverse and show the content of the given .xls file
# -*- coding: utf-8 -*-
from xlrd import *
wb = open_workbook('sample.xls')
for sheet in wb.sheets():
print 'Sheet: {0}'.format(sheet.name)
for row in range(sheet.nrows):
row_value = []
for col in range(sheet.ncols):
row_value.append(sheet.cell(row, col).value)
@mingyc
mingyc / gist:1347164
Created November 8, 2011 06:36
Build instruction of my project #1, comphoto2011
git clone git://github.com/milnex/comphoto2011 /path/to/source
mkdir /path/to/build && cd /path/to/build
cmake /path/to/source
make