Skip to content

Instantly share code, notes, and snippets.

View keiya's full-sized avatar

keiya keiya

View GitHub Profile
@keiya
keiya / gist:1223404
Created September 16, 2011 23:33
128bit bignum multiplying in Assembly
.data
.align 4
x: .long 0x00124011,0x3130FFFF
y: .long 0x07001245,0x12f01348
ans: .long 0,0,0,0
.text
.globl main
main:
@keiya
keiya / parse-apache-log.pl
Created September 26, 2011 10:38
This script parses the apache logfile from STDIN.
#!/usr/bin/perl
#
# by Keiya Chinen
use strict;
use warnings;
my %hosts;
while (my $line = <STDIN>) {
#!/usr/bin/perl
use strict;
use Data::Dumper;
open my $FH,"<prob";
my @depths;
my ($i,$j);
@keiya
keiya / graphics.c.patch
Created November 6, 2011 13:12
patch file of psp library graphics.c ()
--- graphics.c 2007-11-13 15:26:28.000000000 +0900
+++ graphics_modified.c 2011-11-06 22:01:43.000000000 +0900
@@ -1,8 +1,10 @@
+// modified by keiyac
+
#include <stdlib.h>
#include <malloc.h>
#include <pspdisplay.h>
#include <psputils.h>
-#include <png.h>
@keiya
keiya / nfd2nfc.pl
Created November 8, 2011 10:39
Unicode Normalization
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use Encode;
use Unicode::Normalize qw/NFD NFC/;
my $encoding = $ENV{LANG} =~ /euc-?jp/i ? 'euc-jp' : 'utf-8';
binmode STDOUT, ":encoding($encoding)";
@keiya
keiya / download.py
Created November 13, 2011 07:36
multithread downloader
#!/usr/bin/python
import sys, urllib, threading
from Queue import Queue
base_url = 'http://www.keiyac.org/files/'
class FileGetter(threading.Thread):
def __init__(self, url):
self.url = url
@keiya
keiya / keep.js
Created November 22, 2011 01:57
phpMyAdmin Session Keeper
/*! jQuery v1.7 jquery.com | jquery.org/license */
(function(a,b){function cA(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cx(a){if(!cm[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cn||(cn=c.createElement("iframe"),cn.frameBorder=cn.width=cn.height=0),b.appendChild(cn);if(!co||!cn.createElement)co=(cn.contentWindow||cn.contentDocument).document,co.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),co.close();d=co.createElement(a),co.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cn)}cm[a]=e}return cm[a]}function cw(a,b){var c={};f.each(cs.concat.apply([],cs.slice(0,b)),function(){c[this]=a});return c}function cv(){ct=b}function cu(){setTimeout(cv,0);return ct=f.now()}function cl(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ck(){try{return new a.XMLHttpRequest}catch(b){}}function ce(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.l
@keiya
keiya / client.php
Created December 4, 2011 10:09
cdDns (redirect as dynamic dns)
<?php
// specify serverside uri
$cddns_server = "http://www.example.com/cddns/server.php";
// specify alias name of ip address. (like a A record host name)
$alias = 'keiyacorg';
// same as server
$password = 'ponponpain';
@keiya
keiya / xor.php
Created December 13, 2011 13:50
謎のコンテンツ難読化(コンテンツをEPOCH Timeとメルセンヌツイスターで生成したランダムな値でXORにし、JSON Arrayでクライアントへ渡します)
<?php
$str = urlencode('僕は友達が少ない(驚愕)');
$rand = mt_rand(0,floor(time()/100));
$seed = floor(time()/100)+$rand;
$char=array($rand);
for($i=0;$i<mb_strlen($str,'utf-8');$i++){
$hex = bin2hex(mb_substr($str , $i, 1, 'utf-8'));
$char[] = intval($hex,16)^$seed;
}
@keiya
keiya / session.php.diff
Created February 5, 2012 10:53
CodeIgniter Session Lightweight Patch
--- Session_orig.php 2012-02-05 17:59:53.655951256 +0900
+++ Session.php 2012-02-05 18:09:07.779674380 +0900
@@ -21,7 +21,7 @@
* @package CodeIgniter
* @subpackage Libraries
* @category Sessions
- * @author ExpressionEngine Dev Team
+ * @author ExpressionEngine Dev Team & Keiya Chinen <[email protected]>
* @link http://codeigniter.com/user_guide/libraries/sessions.html
*/