Skip to content

Instantly share code, notes, and snippets.

View Y4suyuki's full-sized avatar

Yasuyuki Ageishi Y4suyuki

  • USJ LLC
  • Osaka, Japan
View GitHub Profile
@Y4suyuki
Y4suyuki / pngtopdf.sh
Created February 4, 2013 18:16
convert all pngs to pdfs on Mac OS X
#!/bin/sh
for png in *.png; do
sips -s format pdf "$png" --out "${png%%.*}.pdf"
done
@Y4suyuki
Y4suyuki / time.c
Last active December 13, 2015 20:38
time my function in C.
#include <stdio.h>
#include <time.h>
int main()
{
clock_t tic = clock();
my_func();
clock_t toc = clock();
printf("%f seconds\n", (double)(toc - tic) / CLOCKS_PER_SEC);
return 0;
@Y4suyuki
Y4suyuki / Valid.py
Last active December 14, 2015 05:58
Valid month, day and year
# Validation functions for month, day, and year
months = ['January',
'February',
'March',
'April',
'May',
'June',
@Y4suyuki
Y4suyuki / shuffler.py
Created March 1, 2013 07:04
Udacity Design of Computer Analysis
def swap(deck, i, j):
"Swap elements i and j of a collection."
print 'swap', i, j
deck[i], deck[j] = deck[j], deck[i]
def shuffle2(deck):
"A modification of my teacher's algo"
N = len(deck)
swapped = [False] * N
while not all(swapped):
@Y4suyuki
Y4suyuki / accum.py
Created March 21, 2013 10:13
accumulator in Python
def f(x, y):
return x + y
def foo(f):
def nf(x, *args):
return x if not args else f(x, nf(*args))
return nf
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>SVG Test</title>
<script type="text/javascript" src="d3.v3/d3.v3.js"></script>
</head>
<body>
<script type="text/javascript">
@Y4suyuki
Y4suyuki / D3rect_csv.html
Last active December 16, 2015 11:18
D3 rect barchart with jgbcme.csv [sort, tooltip]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="d3.v3/d3.v3.js"></script>
<style>
#tooltip {
position: absolute;
width: 200px;
height: auto;
@Y4suyuki
Y4suyuki / d3test.html
Created April 20, 2013 14:21
D3 on GAE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>D3 Test</title>
<script type="text/javascript" src = "/static/d3.v3/d3.v3.js"></script>
<link type="text/css" rel="stylesheet" href="/static/d3test.css">
</head>
<body>
@Y4suyuki
Y4suyuki / README.md
Last active December 16, 2015 11:19 — forked from mbostock/.block

Switch between stacked and grouped layouts using sequenced transitions! Animations preserve object constancy and allow the user to follow the data across views. Animation design by Heer and Robertson. Colors and data generation inspired by Byron and Wattenberg.

@Y4suyuki
Y4suyuki / _.md
Created April 22, 2013 10:25
Tributary inlet