This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$user = "$_GET['user']"; | |
$url = "http://s3.amazonaws.com/MinecraftSkins/{$user}.png"; | |
$src = imagecreatefrompng(file_get_contents($url)); | |
$face = imagecrop($src, ['x' => 8, 'y' => 8, 'width' => 8, 'height' => 8]); | |
header('Content-Type: image/png'); | |
imagepng($face); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Remove non-tagged images | |
id=$( docker images | awk '/^<none>/ { print $3 }' | tr '\n' ' ' ) | |
docker rmi ${id} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ccport CONTAINER [option] | |
# Options $2: port range(nmap option format) | |
ip=$(sudo docker inspect -f ' {{ .NetworkSettings.IPAddress }} ' $1) | |
nmap ${ip} $2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Sync hardware clock to NTP | |
apt-get install -y ntpdate | |
ntpdate ntp.nict.jp | |
hwclock --systohc | |
d=$(date +"%Y/%m/%d (%a) %H:%M") ; echo -e "\e[1;36m\e[40m Date : ${d} \e[0m" | |
c=$(hwclock) ; echo -e "\e[1;32m\e[40m Clock : ${c} \e[0m" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
#xxxx-yy-zz形式の文字列から残り日数を求める | |
function getrest_prs($str) { | |
date_default_timezone_set('Asia/Tokyo'); | |
$a = date_parse($str); | |
$year = $a['year']; $month = $a['month']; $day = $a['day']; | |
$t1 = mktime(0,0,0,$month,$day,$year); |
NewerOlder