Skip to content

Instantly share code, notes, and snippets.

View chitoku-k's full-sized avatar
🐱
Becoming a cat

Chitoku chitoku-k

🐱
Becoming a cat
View GitHub Profile
/* タイトルと URL コピーするやつ */
!function (document) {
var text = prompt("コメント:");
if (text == null) {
return;
}
text = text === "" ? "" : text + "\n\n";
var body = document.body;
var element = document.createElement("textarea");
@chitoku-k
chitoku-k / non-blocking-fwrite.php
Created January 22, 2017 13:55
ブロックしない fwrite(のはずが全然速くならなかった)
<?php
$str = str_repeat(PHP_VERSION, 200000);
$len = strlen($str);
$r = null;
$e = null;
$w = [];
$bytes = [];
foreach (range(1, 100) as $i) {
$w[] = $fp = fopen("test{$i}.txt", 'wb');
@chitoku-k
chitoku-k / .travis.linux.yml
Last active September 2, 2022 06:33
ChromeDriver on Travis CI
os: linux
node_js: '12'
sudo: required
env: DISPLAY=':99.0'
dist: trusty
addons:
apt:
update: true
sources:
- google-chrome
@chitoku-k
chitoku-k / babel.html
Last active May 2, 2017 17:36
babel-standalone
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div id="app" style="display: none" :style="{ display: 'block' }">
<input type="button" value="ホモを出す" v-on:click="activate">
<ul>
@chitoku-k
chitoku-k / call-neovim-from-shell.sh
Last active May 5, 2017 18:13
Call Neovim from shell script
python3<<<"import neovim; neovim.attach('socket', path='$NVIM_LISTEN_ADDRESS').input('<C-\\><C-n>')"
@chitoku-k
chitoku-k / webpack.config.js
Last active June 3, 2017 11:22
webpack.config.js
import { path } from 'path';
import { glob } from 'glob';
import { webpack } from 'webpack';
const entries = Object.assign(
...glob.sync('./app/webroot/scripts/js/test/**/entry.js')
.map(file => ({ [ path.basename(path.dirname(file)) ]: file }))
);
console.log(Object.keys(entries))
doruȝ-
dorw
dorwe
dorwgh
dourȝh
drowgȝ
durghe
durwe
-thogh
thorch
<template>
<article>{{ message }}</article>
</template>
<script lang="babel">
module.exports = {
computed: {
...Vuex.mapState([
'message',
]),
@chitoku-k
chitoku-k / v6plus.php
Last active April 29, 2018 03:46
MAP-E のアドレス変換器(PHP >= 7.1.0)
<?php
// https://qiita.com/mpyw/items/0fdffd3c70b3abd802f5
function array_group_by_range(array $array, $separator = '-')
{
sort($array, SORT_NUMERIC);
$pairs = $ranges = [];
foreach (array_values(array_unique($array, SORT_NUMERIC)) as $i => $v) {
$pairs[$v - $i][isset($pairs[$v - $i])] = $v;
}
@chitoku-k
chitoku-k / lb-transition.sh
Created May 14, 2018 14:25
Send a Slack notification when load-balance status has been updated (for EdgeRouter)
#!/bin/bash
RUN=/opt/vyatta/bin/vyatta-op-cmd-wrapper
# Slack Webhook
HOOK_URL=''
# Arguments
GROUP=$1
INTF=$2
STATUS=$3