Skip to content

Instantly share code, notes, and snippets.

View potato4d's full-sized avatar
💭
It's not so easy to be consistent

Takuma HANATANI potato4d

💭
It's not so easy to be consistent
View GitHub Profile
@potato4d
potato4d / Tes.soSNSpost.py
Last active August 29, 2015 13:58
Tes.so SNS Post. Attention: tssns2.dll is necessary
#!python2
#coding:utf-8
import sys
from ctypes import *
if __name__ == '__main__':
lib = windll.tssns2
ID = "YourID"
PASS = "YourPassword"
@potato4d
potato4d / basesixtyfour.py
Created May 29, 2014 13:56
base64 encoder and decoder for python3.x
#!/usr/local/bin/python
#coding:utf-8
import sys
import base64
def s2b64_encode(file):
#bytes -> base64
#in filename(string)
@potato4d
potato4d / Advent2014.pde
Created December 22, 2014 12:24
Processing Advent Calender 2014
import ketai.sensors.*;
KetaiSensor sensor;
float x, y, z, r;
float vx, vy, vz;
void setup(){
sensor = new KetaiSensor(this);
sensor.start();
orientation(LANDSCAPE);
x = width/2;
@potato4d
potato4d / app.py
Last active August 29, 2015 14:22
Python Bottleを使ってみる ref: http://qiita.com/potato4d/items/a1ad71d3c9bf7fa046bc
@route('/')
def index():
# Logic
return template("index")
@route('/', method="POST")
def do_process():
# Logic
value = request.forms.get('foo')
return template("result", value)
@potato4d
potato4d / bookmarklet
Created July 6, 2015 08:53
Mac版Chromeでの[か][字][カ]を一応解消するブックマークレット
/**
* jQueryの読み込みコードはこちらを使っています。
* http://qiita.com/otchy/items/5c4f2e1b2a93ac200f1c
**/
javascript:(function(f,s){s=document.createElement("script");s.src="//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js";s.onload=function(){f(jQuery.noConflict(true))};document.body.appendChild(s)})(function($){ $("*").css("font-family", "sans-serif"); })
@potato4d
potato4d / topic152717.html
Last active August 29, 2015 14:25
topic152717 answer
<!DOCTYPE html>
<html>
<head>
<title>topic 152717 answer</title>
<style>
ul{
list-style: none;
}
ul li a{
@potato4d
potato4d / app.js
Created August 18, 2015 09:39
Ring Zeroの連携テスト
var express = require('express');
var app = express();
var exec = require('child_process').exec;
var addr = "";
app.get('/', function (req, res) {
res.send("hello, world");
});
app.get('/ring', function (req, res) {
@potato4d
potato4d / AdventCalender.satoriku.php
Created December 17, 2015 07:06
某某某某某某某某某アドベントカレンダー17日目の記事らしい
<?php
header('Content-Type: text/plain');
echo <<<EOT
この記事は某某某某某某某某某 Advent Calendar 2015の15日目の記事です。遅刻すみません。
こんなんなにを書けっていうんだ……
Twitterのりくサー(?)好きっつーかTwitterの絡みの7割ぐらいになってるから身内ネタ最高って感じです。
そういえば初めはsoft_hat界隈と認識してたんだよね。実は。(初めて見たのがTes.Soなので)
@potato4d
potato4d / d_and_d_upload.php
Last active January 25, 2016 05:33
同一ディレクトリに両方のファイルを置いてる前提
<?php
$uploaddir = __DIR__."/";
$uploadfile = $uploaddir . basename($_FILES['file']['name']);
if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) {
// バージョン依存問題の解消
if(function_exists("http_response_code")){
http_response_code(200);
}else{
header('HTTP', true, 200);
}
@potato4d
potato4d / index.html
Created January 18, 2016 02:15
underscore.jsの機能使ってごにょごにょ。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>underscore.js sample</title>
</head>
<body>
<ul id="list">