Skip to content

Instantly share code, notes, and snippets.

# -*- coding: utf-8 -*-
import datetime
from threading import Thread
from Queue import Queue as queue
import SocketServer
import logging
import logging.handlers
class UTC(datetime.tzinfo):
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <stdio.h>
#include <setjmp.h>
sigjmp_buf return_point;
/* 適切で無いハンドラ */
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
struct Stack {
uint32_t used;
int *array;
};
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
struct Stack {
uint32_t used;
int *array;
};
@tell
tell / matrix_mul.c
Created November 3, 2011 02:31
Matrix multiplication in C language
/*
* The author and original source code are from:
* 機械学習序曲(仮) > 数値計算の実行速度 - Python, C, Rの比較
* http://hawaii.naist.jp/~kohei-h/my/python-numeric-comp.html
*
* It is modified version in above Web page.
*
* This program needs data files to construct matrix.
* A generating data files program is published in
* original author's Web page.
@tell
tell / code.sage
Last active September 27, 2015 15:28
Symbolic calculation on Sage 4.7.1 using Napier's constant
## Problem: Do not use symbol 'e'.
## see http://homepage1.nifty.com/herumi/diary/1110.html#14
var('x t a b c d g') # we can not use symbol 'e' instead of 'g'.
assume(t > 0)
f = ((exp(x) - (a + b*x + c*x^2 + d*x^3 + g*x^4))^2).integral(x,0,t)
ans = solve([f.diff(a), f.diff(b), f.diff(c), f.diff(d), f.diff(g)], [a,b,c,d,g])
## work around
@tell
tell / add_asm_main.c
Created August 26, 2011 23:47
Practice Inline ASM on GCC
#include <assert.h>
#include <stdio.h>
void in_emu_add(int *z, const int x, const int y)
{
*z = x + y;
}
void in_asm_add(int *z, const int x, const int y)
{