Skip to content

Instantly share code, notes, and snippets.

Kazuki Tanaka gogotanaka

Block or report user

Report or block gogotanaka

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gogotanaka
gogotanaka / 0_reuse_code.js
Created Nov 28, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@gogotanaka
gogotanaka / libvips-installer.sh
Last active Jun 6, 2016 — forked from h2non/libvips-installer.sh
libvips 7.42.x cross-platform simple installer script (supports OSX, Debian, Ubuntu, CentOS, Fedora, Amazon Linux)
View libvips-installer.sh
#!/bin/sh
#
# Orinally made by Lovell Fuller for sharp
# https://github.com/lovell/sharp
#
# Usage:
# curl -s https://gist.githubusercontent.com/h2non/89bb2f87c6499d0b25f1/raw/bf3d0743107f02f5db2b93c53f7f0e07a1c33112/libvips-installer.sh | sudo bash -
#
View conjgrad.md
function x = conjgrad(A,b,tol)
% CONJGRAD  Conjugate Gradient Method.
%   X = CONJGRAD(A,B) attemps to solve the system of linear equations A*X=B
%   for X. The N-by-N coefficient matrix A must be symmetric and the right
%   hand side column vector B must have length N.
%
%   X = CONJGRAD(A,B,TOL) specifies the tolerance of the method. The
%   default is 1e-10.
%
View ludecomp.c
#include<stdio.h>
main(){
long i,j,N=4,NRHS=1,IPIV[N],LDA=N,LDB=N,INFO;
double A[N*N],b[N];
/* 変数の説明 N:変数の数 NRHS:右辺の列数 IPIV[N]:Pivot選択の情報
LDA:左辺の行数 LDB:右辺の行数 INFO:ルーチンが成功したかどうかを返す */
/* 配列の引数は列に対して連続になるようにする(例:1行1列の次は2行1列) */
View tridiag.c
/* 三重対角行列を係数行列に持つ連立一次方程式の数値解法(掃き出し法) */
/* 係数行列A=(a_{i,j})はa_{i,j}=2(if i==j),-1(if |i-j|==1),0(otherwise)である。*/
/* これは1次元微分方程式の離散化ではよく見かける形式である */
#include<stdio.h>
main(){
int i,j;
long N=10,NRHS=1,IPIV[N],LDA=N,LDB=N,INFO;
double DL[N-1],D[N],DU[N-1],b[N],h=1./N,hs=h*h;
View gist:6ce2a540caa674793e0d
(defun _null (x)
(eq x NIL))
(defun _or (x y)
(if x t (if y t NIL)))
(defun _not (x)
(if x NIL t))
(defun _and (x y)
View gist:c5ac4786386807b2c609
(load "blockdata.lsp")
(load "helper.lsp")
(defun match-element (x y)
(or (equal x y) (equal y '?)))
(defun match-triple (x pat)
(every #'match-element x pat))
View test.lsp
(load "blockdata.lsp")
(defun match-element (x y)
(or (eq x y) (eq y '?)))
(match-element 1 1)
(match-element 1 2)
(match-element 1 '?)
(defun match-triple (x pat)
@gogotanaka
gogotanaka / gist:8b3c3317b5be971dc755
Last active Aug 29, 2015
Add lat and lng to venue
View gist:8b3c3317b5be971dc755
Venue.where("latitude IS NULL").map{|v| v.latitude = v.location.lat; v.longitude = v.location.lng;v.save }
Venue.where("latitude IS NULL").
Venue.where("dbapp_id IS NULL").each do |v|
lat_lng = GogoMaps.get_latlng(v.location.to_pretty_full) rescue next
v.latitude = lat_lng[:lat]
v.longitude = lat_lng[:lng]
v.save
end
View gist:379b00397d494a2b22d2

Ruby, math.c with Fixnum, after r49449

require 'benchmark'

print 'cos   '; puts Benchmark.realtime { 10_000_000.times { Math.cos    1    }}
print 'sin   '; puts Benchmark.realtime { 10_000_000.times { Math.sin    1    }}
print 'tan   '; puts Benchmark.realtime { 10_000_000.times { Math.tan    1    }}
print 'acos  '; puts Benchmark.realtime { 10_000_000.times { Math.acos   1    }}
print 'asin  '; puts Benchmark.realtime { 10_000_000.times { Math.asin   1    }}
print 'atan  '; puts Benchmark.realtime { 10_000_000.times { Math.atan   1    }}
You can’t perform that action at this time.