Skip to content

Instantly share code, notes, and snippets.

@sonesuke
sonesuke / sample.py
Created October 28, 2017 12:05
falcon upload
import falcon
from falcon_multipart.middleware import MultipartMiddleware
# http --from localhost:8888 file@sample.txt
class SampleResource:
def on_post(self, req, resp, **kwargs):
f = req.get_param('file')
raw = f.file.read()
with open('file.txt', 'wb') as f:
@sonesuke
sonesuke / gmres.c
Created October 10, 2017 14:54
fdgmres
#include <cblas.h>
#include <math.h>
#include <memory.h>
#include <stdio.h>
typedef enum {GMRES_SUCCESS, GMRES_NOT_CONVERGENCE} GMRES_RESULT;
typedef void (*axfunc)(double*, double*);
@sonesuke
sonesuke / gmres.c
Created October 9, 2017 12:49
gmres
#include <cblas.h>
#include <math.h>
#include <memory.h>
typedef enum {GMRES_SUCCESS, GMRES_NOT_CONVERGENCE} GMRES_RESULT;
typedef void (*axfunc)(double*, double*);
/* Compute the Givens rotation matrix parameters for a and b. */
@sonesuke
sonesuke / f2c_install.sh
Created October 9, 2017 00:34
install f2c on OSX
#http://qiita.com/yukiB/items/5ac2e9ccbfa5634d405c
setenv INSTALL /usr/local
curl "http://netlib.sandia.gov/cgi-bin/netlib/netlibfiles.tar?filename=netlib/f2c" -o "f2c.tar"
tar -xvf f2c.tar
gunzip -rf f2c/*
cd f2c
mkdir libf2c
mv libf2c.zip libf2c
cd libf2c
@sonesuke
sonesuke / format.py
Created August 27, 2017 06:35
change row and col in pandas
import pandas as pd
def f(a):
a.index = [0 for i in range(len(a))]
del a['rot']
out = a[0:1]
for i in range(1, len(a)):
out = out.join(a[i:i+1], rsuffix='{0}'.format(i))
sudo apt-get install haskell-platform
cabal update
cabal install pandoc
make sure path
cabal path is ${HOME}/.cabal/bin
sudo apt-get install graphviz libgraphviz-dev pkg-config python-dev
git clone https://github.com/jgm/pandocfilters.git
@sonesuke
sonesuke / gist:3765806
Created September 22, 2012 10:43
nunit
mcs -t:library Account.cs
mcs -t:library -r:nunit.framework,Account.dll AccountTest.cs
nunit-console AccountTest.dll
@sonesuke
sonesuke / gist:3489467
Created August 27, 2012 15:24
gist css
/*
custom style for gist
div.section と組み合わせて適用範囲を限定することで、標準の.gist-xxxxの設定を上書きしている。
*/
div.section .gist .gist-file .gist-data pre{
-moz-border-radius-bottomleft: 0;
-moz-border-radius-bottomright: 0;
-webkit-border-bottom-left-radius: 0;
-webkit-border-bottom-right-radius: 0;
background: #000000 !important;
@sonesuke
sonesuke / gist:3367028
Created August 16, 2012 04:48
paste gist to tumlr
<div class="gist">https://gist.github.com/3364994</div>
@sonesuke
sonesuke / gist:3364994
Created August 16, 2012 00:30
.htaccess expire date
ExpiresActive On
ExpiresByType image/png "access plus 20 days"
ExpiresByType image/jpg "access plus 50 days"
ExpiresByType image/jpeg "access plus 50 days"
ExpiresByType image/ico "access plus 10 month"
ExpiresByType image/gif "access plus 30 days"
ExpiresByType text/javascript "access plus 8 days"
ExpiresByType application/javascript "access plus 8 days"
ExpiresByType text/css "access plus 8 days"