Skip to content

Instantly share code, notes, and snippets.

View mironal's full-sized avatar
🍷

mironal mironal

🍷
View GitHub Profile
mysql> show tables;
+--------------------------+
| Tables_in_db_hogehoge |
+--------------------------+
| entrys |
| timestamps |
+--------------------------+
mysql> desc entrys;
+--------------+--------------+------+-----+---------+----------------+
mysql> show tables;
+--------------------------+
| Tables_in_db_hogehoge |
+--------------------------+
| contents |
| entrys |
| timestamps |
+--------------------------+
mysql> desc contents;
package hoge.twittext;
import twitter4j.Twitter;
import twitter4j.TwitterException;
import twitter4j.TwitterFactory;
public class TwitText {
public static void main(String[] args) throws TwitterException {
if (args.length < 1) {
System.out.println("Usage: tweet");
debug=true
oauth.consumerKey=hogehogehogehogehogehogehogehoge
oauth.consumerSecret=hogehogehogehogehogehogehogehoge
oauth.accessToken=hogehogehogehogehogehogehogehoge
oauth.accessTokenSecret=hogehogehogehogehogehogehogehoge
@mironal
mironal / content_type_json.php
Created June 16, 2012 01:10
header("Content-type: application/json; charset=utf-8"); php
<?php
header("Content-type: application/json; charset=utf-8");
/* something... */
?>
<?php
header('Content-Type: text/html; charset=urf-8');
$json = Array();
$json['sctipt'] = '<body onload=alert(1)>';
$json['miss img'] = '<img src=img.jpg>';
echo json_encode($json);
?>
<?php
header('Content-Type: application/json; charset=urf-8');
$json = Array();
$json['sctipt'] = '<body onload=alert(1)>';
$json['miss img'] = '<img src=img.jpg>';
echo json_encode($json);
?>
<script>
/* 乱数の発生具合を調べる */
var loop = 1000000;
var rslt = new Array(50); /* 0 から (rslt.length - 1)までの乱数 */
for(var i = 0; i < loop; i++){
/* 乱数生成 */
var r = Math.floor(Math.random() * rslt.length);
if(!rslt[r]){
rslt[r] = 1;
@mironal
mironal / mo_ma.js
Created June 20, 2012 06:52
形態素解析からのマルコフ連鎖
<script type="text/javascript" src="js/tiny_segmenter-0.1.js" charset="UTF-8"></script>
<script type="text/javascript" src="js/kumono_ito.js" charset="UTF-8"></script>
<script>
$(function(){
/* 形態素解析される文章(text)は、kumono_ito.js内に定義されている. */
/*形態素解析機 */
var segmenter = new TinySegmenter();
<?php
/* フォームからの入力をエスケープ */
function h($s){
return htmlspecialchars($s,ENT_QUOTES);
}
?>