Skip to content

Instantly share code, notes, and snippets.

<?php
session_start();
$oauth = new OAuth($_SESSION['consumer_key'], $_SESSION['consumer_secret'], OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_URI);
if (substr(PHP_OS, 0, 3) == 'WIN') {
$caPath = 'C:/xampp/perl/vendor/lib/Mozilla/CA/';
$caInfo = "${caPath}cacert.pem";
$oauth->setCAPath($caPath, $caInfo);
}
<?php
header('Content-type:text/plain; charset=utf-8');
session_start();
$oauth = new OAuth($_SESSION['consumer_key'], $_SESSION['consumer_secret'], OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_URI);
if (substr(PHP_OS, 0, 3) == 'WIN') {
$caPath = 'C:/xampp/perl/vendor/lib/Mozilla/CA/';
$caInfo = "${caPath}cacert.pem";
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Twitter OAuth Post</title>
</head>
<body>
<?php
session_start();
<?php
session_start();
session_destroy();
?>
<!doctype html>
<html>
<head>
<title>Logout</title>
</head>
<body>

Twitter公式クライアントのコンシューマキー

Twitter for iPhone

Consumer key: IQKbtAYlXLripLGPWd0HUA
Consumer secret: GgDYlkSvaPxGxC4X8liwpUoqKwwr3lCADbz8A7ADU

Twitter for Android

Consumer key: 3nVuSoBZnx6U4vzUxf5w
Consumer secret: Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys

Twitter for Google TV

Consumer key: iAtYJ4HpUVfIUoNnif1DA

@taroyabuki
taroyabuki / opencl-mandelbrot.m
Last active December 15, 2015 04:50
マンデルブロ集合をOpenCLで描く(Mathematica) http://blog.unfindable.net/archives/5772
Needs["OpenCLLink`"]
kernelCode = "
# ifdef USING_DOUBLE _PRECISIONQ
# pragma OPENCL EXTENSION cl_khr _fp64 : enable
# pragma OPENCL EXTENSION cl_amd _fp64 : enable
# endif /* USING_DOUBLE _PRECISIONQ */
int check(Real_t x, Real_t y, int maxSteps) {
Real_t re = 0, im = 0;
@taroyabuki
taroyabuki / manipulate-opencl-mandelbrot.m
Last active December 15, 2015 04:50
マンデルブロ集合をOpenCLでインタラクティブに描く(Mathematica) http://blog.unfindable.net/archives/5772
buffer = OpenCLMemoryAllocate["Integer32", {height, width}];
Manipulate[Module[{
xMin = center[[1]] - 10^scale, xMax = center[[1]] + 10^scale,
yMin = center[[2]] - 10^scale, yMax = center[[2]] + 10^scale},
kernel[buffer, IntegerPart[10^maxSteps], width, height, xMin, xMax, yMin, yMax];
ArrayPlot[OpenCLMemoryGet[buffer],
DataRange -> {{xMin, xMax}, {yMin, yMax}},
DataReversed -> True, ColorFunction -> "Rainbow"]],
{{center, {-0.5, 0}}, Locator},
@taroyabuki
taroyabuki / cpu-mandelbrot.nb
Last active December 15, 2015 05:49
マンデルブロ集合(Mathematica) http://blog.unfindable.net/archives/3512
Clear@f;
f[c_] := f[c, 0., 0]
f[_, _, 100] = -1;
f[c_, z_, i_] := With[{x = z^2 + c}, If[2 < Abs@x, i, f[c, x, i + 1]]]
xMin = -2;
xMax = 1;
yMin = -3/2;
yMax = 3/2;
dx = (xMax - xMin)/300;
@taroyabuki
taroyabuki / cuda-mandelbrot.nb
Last active December 15, 2015 05:49
マンデルブロ集合をCUDAで描く(Mathematica) http://blog.unfindable.net/archives/3512
Needs["CUDALink`"]
CUDAQ[]
kernelCode = "
__device__ int check(Real_t x, Real_t y, int maxSteps) {
Real_t re = 0, im = 0;
int i = 0;
while (i++ < maxSteps) {
Real_t newRe = re * re - im * im + x;
@taroyabuki
taroyabuki / manipulate-cuda-mandelbrot.nb
Last active December 15, 2015 05:49
マンデルブロ集合をCUDAでインタラクティブに描く(Mathematica) http://blog.unfindable.net/archives/3512
buffer = CUDAMemoryAllocate["Integer32", {height, width}];
Manipulate[With[{
xMin = center[[1]] - 10^scale, xMax = center[[1]] + 10^scale,
yMin = center[[2]] - 10^scale, yMax = center[[2]] + 10^scale},
kernel[buffer, IntegerPart[10^maxSteps], width, height, xMin, xMax, yMin, yMax];
ArrayPlot[CUDAMemoryGet[buffer],
DataRange -> {{xMin, xMax}, {yMin, yMax}},
DataReversed -> True, ColorFunction -> "Rainbow"]],
{{center, {-0.5, 0}}, Locator},