Skip to content

Instantly share code, notes, and snippets.

View aiwas's full-sized avatar
💭
hey

Miyako Kuwano aiwas

💭
hey
View GitHub Profile
@aiwas
aiwas / getrest.php
Last active December 16, 2015 11:08
for old version
<?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);
@aiwas
aiwas / synctime.sh
Last active August 29, 2015 14:05
Synchronize hardware clock to NTP
#!/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"
@aiwas
aiwas / get_minecraft_skinface.php
Created November 13, 2014 20:45
Require PHP>=5.5.0だしテストもしてない
<?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);
@aiwas
aiwas / get_minecraft_skinface.php4
Created November 18, 2014 02:24
Minecraftのスキンの顔部分を取得する奴 4.xでもうごく
<?php
$user = $_GET['user'];
$url = "http://s3.amazonaws.com/MinecraftSkins/{$user}.png";
$skin = imagecreatefrompng($url);
$face = imagecreatetruecolor(8, 8);
imagecopy($face, $skin, 0, 0, 8, 8, 8, 8);
header('Content-Type: image/png');
@aiwas
aiwas / CardCut.scm
Last active August 29, 2015 14:10
端末のSSからスクフェスのカード部分を切り抜くやつ
(define (script-fu-CardCut img layer)
(gimp-image-rotate img 2)
(gimp-image-resize img 1080 1520 0 -201)
(gimp-layer-resize-to-image-size layer)
(gimp-displays-flush)
) ;end of define
(script-fu-register
@aiwas
aiwas / keybase.md
Created December 25, 2017 12:38
Keybase proof

Keybase proof

I hereby claim:

  • I am aiwas on github.
  • I am aiwas (https://keybase.io/aiwas) on keybase.
  • I have a public key ASDodDuthaHUcK_01MO0Kvf8nYQpWgnPCIpwYZOhSkPLWwo

To claim this, I am signing this object:

@aiwas
aiwas / Remove-NeedlessPackage.ps1
Last active April 5, 2020 09:42
Windows 10 において不要なプリインストールアプリケーションを抹殺するやつ
# 参考: https://news.mynavi.jp/article/win10tips-171/
$appList = @(
"Microsoft.BingNews", # ニュース
"Microsoft.BingFinance", # マネー
"Microsoft.BingSports", # スポーツ
#"Microsoft.BingWeather", # 天気
"Microsoft.ConnectivityStore", # Wi-Fi
"Microsoft.Getstarted", # Get Started
"Microsoft.GetHelp", # 問い合わせ
@aiwas
aiwas / mastodon-share-autoclose.user.js
Last active February 25, 2019 18:39
/shareが自動で閉じないことに納得がいかないのを解消するスクリプト
// ==UserScript==
// @name Mastodon Share Page Auto-Closer
// @namespace https://github.com/aiwas/
// @version 0.2
// @description /shareが自動で閉じないことに納得がいかないのを解消するスクリプト
// @author aiwas
// @match https://yysk.icu/share*
// ==/UserScript==
(function() {
@aiwas
aiwas / mod10w3.php
Created March 4, 2019 08:15
モジュラス10 ウェイト3 の再発明
<?php
function mod10w3(string $numeric) {
$num_array = array_reverse(str_split($numeric));
$sum_odd = array_sum(array_map('current', array_chunk(array_slice($num_array, 0), 2)));
$sum_even = array_sum(array_map('current', array_chunk(array_slice($num_array, 1), 2)));
$sum_all = ($sum_odd * 3) + $sum_even;
$mod = $sum_all % 10;
$cd = ($mod == 0) ? 0 : (10 - $mod);
return $cd;
@aiwas
aiwas / .hyper.js
Last active June 9, 2019 14:51
Hyper Terminal settings
// .hyper.js
// last modified: 2019/05/07
module.exports = {
config: {
updateChannel: 'stable',
lineHeight: 1.5,