curl -v http://git.company.com
: Verbose the response when accessing http://git.company.comcurl -L http://git.company.com
. Then will redirect to the Location: header.tunarcproxy.sh
, which port-forwarding internal-proxy-server-port to localhost:12345export http_proxy="http://localhost:12345"
(unset http_proxy
)export https_proxy="http://localhost:12345"
(unset https_proxy
)#!/bin/sh
exec ruby -S -x "$0" "$@"
#!ruby
# -*- coding: utf-8 -*-
puts RUBY_VERSION
print("Hello, Ruby\n")
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
puts RUBY_VERSION
print("Hello, Ruby\n")
<!-- -*- coding: utf-8 -*- -->
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<meta charset="utf-8">
</head>
<body>
<p>Hello, world!</p>
</body>
</html>
sudo apt-get install open-vm-tools
sudo poweroff
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://[stable.]melpa.org/packages/") t)
Host vm-remote.ext
User userremote
HostName vm-remote.shamei.co.jp
ProxyCommand ssh userproxy@proxy.shamei.co.jp -W %h:%p
PATH=/some/path:$PATH
export PATH
(add-to-list 'tramp-remote-path 'tramp-own-remote-path)
tail -n+10 file.sh | head -1
sed '10q;d' file.sh
source <(tail -n+10 file.sh | head -1)
tail -n+10 file.sh | head -1 | source /dev/stdin
source <(tail -n+10 file.sh)
tail -n+10 file.sh | source /dev/stdin
apachectl configtest
!<?php
echo "Hello PHP";
phpinfo();
?>
For pure PHP file, DO NOT close with php closing tag! That is, "?>" is NOT needed.<html>
<head><title>PHP TEST</title></head>
<body>
<?php
$link = mysql_connect('localhost:/tmp/mysql.sock', 'testuser', 'thepswd');
if (!$link) {
die('接続失敗です。'.mysql_error());
}
print('<p>接続に成功しました。</p>');
// MySQLに対する処理
$close_flag = mysql_close($link);
if ($close_flag){
print('<p>切断に成功しました。</p>');
}
?>
</body>
</html>
<html>
<head>
<title>PHP TEST</title>
</head>
<body>
<?php
$link = mysql_connect('localhost:/tmp/mysql.sock', 'testuser', 'thepswd');
if (!$link) {
die('接続失敗です。'.mysql_error());
}
print('<p>接続に成功しました。</p>');
$db_selected = mysql_select_db('uriage', $link);
if (!$db_selected){
die('データベース選択失敗です。'.mysql_error());
}
print('<p>uriageデータベースを選択しました。</p>');
mysql_set_charset('utf8');
$result = mysql_query('select id,name from shouhin');
if (!$result) {
die('クエリーが失敗しました。'.mysql_error());
}
while ($row = mysql_fetch_assoc($result)) {
print('<p>');
print('id='.$row['id']);
print(',name='.$row['name']);
print('</p>');
}
$close_flag = mysql_close($link);
if ($close_flag){
print('<p>切断に成功しました。</p>');
}
?>
</body>
</html>
<?php
// $filename = "newfile.txt";
// $file = fopen( $filename, "w" );
// if( $file == false ) {
// echo ( "Error in opening new file" );
// exit();
// }
// fwrite( $file, "This is a simple test\n" );
// fclose( $file );
?>
<?php
echo exec('whoami') . "\n <br>";
echo exec('groups') . "\n <br>";
echo exec('echo $PATH') . "\n <br>";
echo exec('which whoami') . "\n <br>";
echo exec('pwd') . "\n <br>";
echo exec('w') . "\n <br>";
echo exec('cd ~') . "\n <br>";
echo exec('cd ..') . "\n <br>";
echo exec('echo $HOME') . "\n <br>";
echo exec('pwd') . "\n <br>";
echo exec('date') . "\n <br>";
$phpdate = getdate();
foreach($phpdate as $key => $val) {
print "$key = $val\n<br />";
}
echo "\n <br>";
// echo exec('mkdir ./tutorpnt2') . "\n <br>";
echo exec('cd ./tutorpnt') . "\n <br>";
echo exec('pwd') . "\n <br>";
<?php echo sys_get_temp_dir(); ?>
<!-- -*- coding: utf-8 -*- -->
<?php
session_start();
$echoedShout = "";
if(count($_POST) > 0) {
$_SESSION['shout'] = $_POST['shout'];
header("HTTP/1.1 303 See Other"); // For redirection.
// header("Location: http:$_SERVER[HTTP_HOST]/mytest/prg/echochamber.php");
header("Location: ./echochamber.php");
// OR
// header("Location: ./echochamber.php?redirect=true");
die();
}
else if (isset($_SESSION['shout'])){
$echoedShout = $_SESSION['shout'];
/*
Put database-affecting code here.
*/
session_unset();
session_destroy();
}
?>
<!DOCTYPE html>
<html>
<head><title>PRG Pattern Demonstration</title>
<body>
<?php echo "<p>$echoedShout</p>" ?>
<form action="./echochamber.php" method="post">
<input type="text" name="shout" value="" />
</form>
</body>
</html>