Skip to content

Instantly share code, notes, and snippets.

Kana Natsuno kana

Block or report user

Report or block kana

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kana
kana / nes-ize
Created May 23, 2019
NES-ish image color reduction
View nes-ize
#!/bin/bash
if ! [ "$#" = 1 ]
then
echo "Usage: $0 FILE"
exit 1
fi
d="$(identify "$1" | cut -d' ' -f3)"
width="${d/x*/}"
@kana
kana / t-right-to-left-2-up.sh
Last active May 15, 2019
Rearrange PDF pages
View t-right-to-left-2-up.sh
# Original PDF:
# 1. Front cover
# 2. content 1
# 3. content 2
# 4. ...
# 5. content -2
# 6. content -1
# 7. Back cover
#
# Resulting PDF:
View slack-review-counter.js
const bodyParser = require('body-parser')
const express = require('express')
const moment = require('moment-timezone')
const slack = require('slack')
const VERIFICATION_TOKEN = process.env.VERIFICATION_TOKEN
const OAUTH_ACCESS_TOKEN = process.env.OAUTH_ACCESS_TOKEN
const app = express()
View nicegif
#!/bin/bash
colors=256
fps=30
half=
while true
do
case "$1" in
'-c')
View fukusayou.php
<?php
$a = 1;
debug_zval_dump($a);
//==> long(1) refcount(2)
// Novice: Huh? Why is refcount 2? The value is only pointed by $a, so refcount must be 1!
// Tatsujin: PHP uses copy-on-write. The value is passed by value to debug_zval_dump.
// It doesn't modify the passed value. The value is shared by $a and debug_zval_dump.
// Therefore refcount is 2.
@kana
kana / tomodachi.php
Created Aug 17, 2017
Don't confuse PHP & reference with other languages' reference.
View tomodachi.php
<?php
function test_copy_on_write()
{
print "test_copy_on_write\n";
$a = 100;
xdebug_debug_zval('a');
//==> a: (refcount=1, is_ref=0)=100
View php.vim
function! s:_GetCwordStartPos()
let cword = expand('<cword>')
let cword_pattern = '\V' . escape(cword, '\')
let cword_end_pos = searchpos(cword_pattern, 'ceW', line('.'))
let cword_start_pos = searchpos(cword_pattern, 'bcW', line('.'))
return cword_start_pos
endfunction
function! s:GuessClassName()
let cursor_pos = getpos('.')
View decremental.js
var mapped = gearSets.map(function (gearSet, i) {
var countMap = JSON.parse(JSON.stringify(required.countMap));
return {
index: i,
value: [
gearSet.shoes === anyGear ? 1 : 2,
gearSet.clothing === anyGear ? 1 : 2,
gearSet.headgear === anyGear ? 1 : 2,
countMap[gearSet.headgear.main]-- > 0 ? 1 : 2,
@kana
kana / splatoon-weapon-damage.txt
Last active Aug 29, 2015
Splatoonブキダメージ
View splatoon-weapon-damage.txt
Splatoon ブキダメージ
ブキ 攻撃力アップ(メイン) 攻撃力アップ(サブ) 防御力アップ ダメージ
わかばシューター 0 0 0 28.0 / 56.0 / 84.0 / 112.0
わかばシューター 0 0 1 26.5 / 53.1 / 79.7 / 106.3
わかばシューター 0 0 2 25.4 / 50.8 / 76.2 / 101.6
わかばシューター 0 0 3 24.5 / 49.0 / 73.5 / 98.0 / 122.5
スプラシューター 0 0 0 36.0 / 72.0 / 108.0
スプラシューター 0 0 1 34.1 / 68.3 / 102.5
You can’t perform that action at this time.