Skip to content

Instantly share code, notes, and snippets.

@wsuzume
wsuzume / stopwatch.h
Created July 4, 2015 12:30
simple timer
#pragma once
#include <stdlib.h>
#include <time.h>
#include <sys/time.h>
typedef struct stopwatch_t *StopWatch;
struct stopwatch_t {
struct timeval start;
@wsuzume
wsuzume / prvm.cpp
Last active March 24, 2016 13:43
useage: ./prvm program
#include <stdio.h>
#include <stdlib.h>
int chaser; //code chaser
int prgsize; //program size
int add(int *src)
{
printf("add %d %d = ", src[chaser+1], src[chaser+2]);
chaser += 3;
@wsuzume
wsuzume / compiler.cpp
Last active March 24, 2016 13:42
useage: ./compiler source dest
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int rmindent(char *buf)
{
int i;
for (i = 0; ; i++) {
if (buf[i] != ' ') {
@wsuzume
wsuzume / prvm02.cpp
Last active April 8, 2016 17:11
procyon virtual machine
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "type.h"
#include "rgsmap.h"
#define OPRND1(var) ((var>>8)&0x0000000f)
#define OPRND2(var) (var&0x0000000f)
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "type.h"
#include "rgsmap.h"
#include "instmake.h"
#define INST1(var) (var&0x000000ff)
#define INST2(var) (((var&0x0000ff00)>>8)|((var&0x000000ff)<<8))
@wsuzume
wsuzume / repo.py
Last active December 17, 2016 11:30
#!/usr/bin/env python
#coding: UTF-8
import Image
import sys
def threshold(x,a):
if x > a:
return 1
else:
@wsuzume
wsuzume / o_transform.py
Created August 12, 2017 22:20
o_transform transforms "time series signal of values" to "current values taking past values into account in each terms"
import numpy as np
def o_transform(signal):
ret = []
for n in range(1, len(signal)+1):
a = 2 / (n + 1)
d = -2 / (n * (n + 1))
s = 0
for t in range(n):
#coding:utf-8
import numpy as np
class WhiteningScaler:
def __init__(self, axis=0, threshold=1e-12, apply_zca=False):
# 行方向にデータが格納されている場合は axis=0
# 列方向にデータが格納されている場合は axis=1
self.axis = axis
self.threshold = threshold
i=
_am=
stair=
_maker_=
eval(s=%q[
eval(%q[def_
stair(s)_if_AR
GV.size()==0_the
n_10.upto(50)_do_|
i|_puts(s.slice!(0,i
@wsuzume
wsuzume / ishitah.ipynb
Last active June 15, 2018 16:04
Solution for ishitah's problem
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.