- rootがない状況なので
$HOME/local
へ入れる - configureで使うライブラリがないので
apt-cache search hoge
でさがしてapt-get source hoge
で入れて configure, make, make installする
cd ~
mkdir -p {bin,tmp,etc/profile.d,swap,undo,backup,tags,src,.trash,.tmux,build}
#!/usr/bin/env node | |
const | |
fs = require('fs'), | |
path = require('path'), | |
markdownpdf = require('markdown-pdf'); | |
const walk = (dir, callback) => { | |
fs.readdirSync(dir).forEach((item) => { | |
const filePath = path.join(dir, item); |
<?php | |
var_dump(ini_get('precision')); | |
var_dump(ini_get('serialize_precision')); | |
$test = [ | |
'rank1' => 32.361 * 1000, | |
'rank2' => 32.361 * 1, | |
'rank3' => 32.361 * 10, | |
'rank4' => 32.361 * 100, | |
'rank5' => (int)(string)(32.361 * 1000), |
<?php | |
function f($in, $required) { | |
$keys = array_keys(array_intersect_key(($in), array_flip($required))); | |
sort($keys); | |
sort($required); | |
return $keys === $required; | |
} | |
$required = array('key1', 'key2'); |
CREATE TABLE `samples` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`comment` varchar(255) NOT NULL, | |
`created` datetime NOT NULL, | |
PRIMARY KEY (`id`,`created`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 | |
PARTITION BY RANGE COLUMNS(`created`) ( | |
PARTITION samples_p20170427 VALUES LESS THAN('2017-04-28 00:00:00'), | |
PARTITION samples_p20170428 VALUES LESS THAN('2017-04-29 00:00:00') | |
); |
<?php | |
$a = array('name' => array( 'error1', 'error2')); | |
$b = array('email' => array('error3', 'error4')); | |
$errors = array_merge($a, $b); | |
$result = array_reduce($errors, function($c, $v) { return array_merge($c, $v); }, array()); | |
print_r($errors); | |
print_r($result); | |
print_r(implode('\n', $result)); |
mkdir ~/build | |
cd ~/build | |
wget https://www.kernel.org/pub/software/scm/git/git-2.9.0.tar.gz | |
tar xzf git-2.9.0.tar.gz | |
cd git-2.9.0 | |
make prefix=/usr/local all | |
make prefix=/usr/local install | |
git --version |
<?php | |
$data = ''; | |
$list = array(); | |
if (!empty($_POST['data'])) { | |
$data = $_POST['data']; | |
$matches = array(); | |
$result = preg_match_all("/u'(.*)',|'(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})',/", $data, $matches); | |
if ($result) { | |
$subjects = $matches[1]; | |
$subjects[0] = array_filter($matches[2])[0]; |
--- | |
#################### gather fact about subnet | |
- name: gather a fact about subnet | |
ec2_vpc_subnet_facts: | |
region: '{{ vpc_region }}' | |
filters: | |
'tag:Name': '{{ site_name }}-{{ stage }}-bastion' | |
'tag:env': '{{ stage }}' | |
'tag:Tier': bastion |
print isinstance(1, (int, unicode)) | |
# True | |
print isinstance(u'text', (int, unicode)) | |
# True | |
print isinstance('8-bit string', (int, unicode)) | |
# False |