Skip to content

Instantly share code, notes, and snippets.

@miyukki
miyukki / gist:1073268
Created July 9, 2011 03:31
number2alphabet in php
function number2alphabet($instr) {
$alphabettbl = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z');
$outstr = '';
$len = strlen($instr);
for ($i = 0; $i < $len; $i++) {
$char = substr($instr, $i, 1);
if(is_numeric($char)){
$outstr .= $alphabettbl[$char];
}else{
$outstr .= $char;
@miyukki
miyukki / NicoGadetHack
Created October 15, 2011 00:45
Saving ".vbs" file.
Option Explicit
On Error Resume Next
Dim objWshShell
Dim objFSO
Dim objFile
Set objWshShell = WScript.CreateObject("WScript.Shell")
Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
"^ "
=~ (
("(").("~"^"."^"^"^(""=="")."").("^"
^"="^(""=="").""^")").("^"^".").("="
^"~"^(""=="")."").("("^(""=="^").""^
"."^"^").("("^(""=="").""^"^"^")").(
(" ^( "
== "
") .
"" ^
function getPageTitle($url) {
$html = @file_get_contents($url);
$html = mb_convert_encoding($html, 'UTF-8', 'auto');
if ( preg_match( "/<title>(.*?)<\/title>/i", $html, $matches) ) {
return $matches[1];
} else {
return false;
}
}
@miyukki
miyukki / gist:1521405
Created December 26, 2011 15:28
Dosent Work!
<?php
var_dump(empty('test'));
@miyukki
miyukki / ezXMLParser.js
Created January 28, 2012 14:53
ezXMLParser is simple xml parser.
var ezXMLParser = {};
ezXMLParser.splitXML = function(XMLstr) {
var ret = new Array();
for(var count = 0; ezXMLParser.isExistStrictXML(XMLstr); count++){
//
var xml_end_char_index = XMLstr.indexOf('>');
var xml_start_char_index = XMLstr.indexOf('<');
@miyukki
miyukki / LICENSE.txt
Created March 7, 2012 12:36 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@miyukki
miyukki / role.php
Created March 28, 2012 11:30
role.php is print text in current directory on display, and delete printed text.
<?php
while(true){
if ($handle = opendir('./')) {
/* ディレクトリをループする際の正しい方法です */
while (false !== ($file = readdir($handle))) {
if(endWith($file, '.txt')) {
printComment($file);
}
}
@miyukki
miyukki / BrainStudy.php
Created April 26, 2012 09:40
BrainStudy
<?php
/*
See: http://rocketnews24.com/2012/04/26/207346/
INPUT: 7H15 M3554G3 53RV35 7O PR0V3 H0W 0UR M1ND5 C4N D0 4M4Z1NG 7H1NG5! 1MPR3551V3 7H1NG5! 1N 7H3 B3G1NN1NG 17 WA5 H4RD BU7 N0W, 0N 7H15 LIN3 Y0UR M1ND 1S R34D1NG 17 4U70M471C4LLY W17H0U7 3V3N 7H1NK1NG 4B0U7 17, B3 PROUD! 0NLY C3R741N P30PL3 C4N R3AD 7H15. R3 P057 1F U C4N R34D 7H15.
OUTPUT: THIS MESSAGE SERVES TO PROVE HOW OUR MINDS CAN DO AMAZING THINGS! IMPRESSIVE THINGS! IN THE BEGINNING IT WAS HARD BUT NOW, ON THIS LINE YOUR MIND IS READING IT AUTOMATICALLY WITHOUT EVEN THINKING ABOUT IT, BE PROUD! ONLY CERTAIN PEOPLE CAN READ THIS. RE POST IF U CAN READ THIS.
*/
$subject = trim(fgets(STDIN));
$search = array('0', '1', '3', '4', '5', '7');
@miyukki
miyukki / niconicocommentgetter.php
Created April 28, 2012 17:50
Niconico Comment Getter
<?php
define('NICONICO_MAILADDRESS', '<アカウントアドレス>');
define('NICONICO_PASSWORD' , '<アカウントパスワード>');
$id = @$argv[1];
if(!$id) exit('Usage (sm|lv)[\d]+'.PHP_EOL);
if(strpos($id, 'sm') === 0) getVideoComment($id);
if(strpos($id, 'lv') === 0) getLiveComment($id);
if(strpos($id, 'co') === 0) getLiveComment($id);