Skip to content

Instantly share code, notes, and snippets.

View eru's full-sized avatar
🍺
🍻

Kazuki Hashimoto eru

🍺
🍻
View GitHub Profile
@eru
eru / deploy.php
Created September 22, 2015 09:34
<?php
// visudo
// apache ALL=(ALL) NOPASSWD: /sbin/runuser
$REPO_DIR_USER = '';
$REPO_PATH = '';
header('Content-type: text/plain; charset=utf-8');
echo shell_exec('sudo runuser -l ' . $REPO_DIR_USER . ' -c "pwd && cd ' . $REPO_PATH . ' && git checkout -f master && git pull origin master"');
<?php
echo '$times = array(';
foreach (range(1, 48) as $key) {
$hour = ceil($key / 2);
$half = $key % 2 == 0 ? '半' : '';
echo "\t'" . $key . "' => '" . $hour . "時間" . $half . "',\n";
}
echo ');';
  • build modules
yum install -y expat-devel libcurl-devel openssl-devel zlib-devel perl-ExtUtils-MakeMaker pcre-devel xz-devel ncurses-devel python-devel tcl-devel gettext-devel asciidoc xmlto libtool mercurial
  • git
yum install -y git
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use LWP::UserAgent;
use JSON;
use Parallel::ForkManager;
my $api = 'http://203.141.128.87/perl/domain_check/dm_check_domain.cgi?callback=&domain=';
my $domain_suffix = '.moe';
oko () {
case "$1" in
"1" ) echo "おこ";;
"2" ) echo "激おこ";;
"3" ) echo "激おこプンプン丸";;
"4" ) echo "ムカ着火ファイヤー";;
"5" ) echo "カム着火インフェルノォォォオウ";;
"6" ) echo "激おこスティックファイナリアリティプンプンドリーム";;
"7" ) echo "憤怒バーニングファッキンストリーム";;
"8" ) echo "大噴火レジャントサイクロンフレアァァッ";;
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use WWW::Mechanize;
use Web::Scraper;
use URI;
<?php
$src = '1234567890-^\qwertyuiop@[asdfghjkl;:]zxcvbnm,./_!"#$%&\'()0=~|QWERTYUIOP`{ASDFGHJKL+*}ZXCVBNM<>?_ ';
$dst = '¡™£¢∞§¶•ªº–≠\œ∑´®†\¨ˆøπ“‘åß∂ƒ©˙∆˚¬…æ«Ω≈ç√∫˜µ≤≥÷`⁄€‹›fifl‡°·‚—±|Œ„´‰ˇÁ¨ˆØ∏”’ÅÍÎÏ˝ÓÔÒÚÆ»¸˛Ç◊ı˜Â¯˘¿` ';
switch ($argc) {
case 1:
echo 'php so-crazy.php [-e|-d] <String>' . PHP_EOL;
break;
case 2:
<?php
$html = explode("\n", file_get_contents('http://www.reg.humeia.co.jp/?t=3llist'));
$number_domains = array();
foreach ($html as $v) {
$matches = null;
if (preg_match('/^\<a.*\>([0-9]{3}.JP)\<\/a\>$/', $v, $matches)) {
$number_domains[] = $matches[1];
}
@eru
eru / file0.txt
Created July 31, 2013 06:01
パンくずの区切りを css だけで作る ref: http://qiita.com/eru_tndl/items/954de1f48fc6826cb472
<style type="text/css">
<!--
ul li {
display: inline;
}
ul li+li:before {
content: '\00a0->\00a0';
}
-->
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
# create our directories