Skip to content

Instantly share code, notes, and snippets.

#!/bin/env bash
if [[ $# == 0 ]]; then
echo "Usage: ./twitter-actual-follower.sh (screen_name)" >&2
echo "twurl is required. " >&2
exit 1
fi
echo "Fetching data... (It may take some time. )" >&2
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
{
"plugins": {
"html": true,
"markdown": true,
"jsx": true
},
"rules": {
"preset-japanese": true,
"@textlint-ja/no-synonyms": true,
"@proofdict/proofdict": {
@hata6502
hata6502 / Normalize.php
Last active May 5, 2019 12:47
Laravel Middleware で URL を正規化する例です。
<?php
namespace App\Http\Middleware;
use Closure;
class Normalize
{
/**
* Handle an incoming request.
@hata6502
hata6502 / mvhash
Last active May 21, 2020 23:23
ファイルを8文字IDに名前変更します。
#!/bin/bash -eu
while [ $# -ne 0 ]
do
if [[ $1 =~ ^[0-9a-f]{8}\. ]]; then
shift
continue
fi
hashed=`crc32 <(echo $1)`.${1##*.}
@hata6502
hata6502 / table-of-contents.js
Created April 27, 2019 04:18
table-of-contents
const table_of_contents = document.querySelectorAll(".table-of-contents");
let table_of_contents_counter = 1;
table_of_contents.forEach(table => {
const headings = table.parentElement.querySelectorAll("h1, h2, h3, h4, h5, h6");
const stack = [{ level: 0, element: table }];
headings.forEach(heading => {
const li = document.createElement("li");
const a = document.createElement("a");
const id = `section-${table_of_contents_counter++}`;
@hata6502
hata6502 / trimrate
Last active April 28, 2019 09:30
指定の比率で画像をトリミングします。ImageMagick を使って 16:9 でトリミングするのが面倒だったのでシェルスクリプトにしました。
#!/bin/bash
if [ $# -lt 6 ]; then
echo "Usage: `basename $0` (source path) (width rate) (height rate) (X offset) (y offset) (destination path) [(options)]"
exit 1
fi
width=`identify -format "%w" $1`
height=$((width*$3/$2))
convert "$1" ${@:7} -crop ${width}x${height}+$4+$5 "$6"
@hata6502
hata6502 / gitwitter
Last active May 21, 2022 09:12
git push して Twitter に通知します。
#!/bin/bash
url=`git config --get remote.origin.url`
domain=${url#*@}
domain=${domain#https://}
domain=${domain/:/}
branch=`git rev-parse --abbrev-ref HEAD`
tweet=""
if git rev-parse --verify origin/${branch} >/dev/null 2>&1
@hata6502
hata6502 / index.html
Created February 12, 2019 13:23
Flexbox と SCSS のテスト
<html>
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>Flex Test</h1>
<div class="flex-container">
<div class="flex-item">
@hata6502
hata6502 / patch.js
Created August 14, 2018 13:33
npm でインストールした ot.js の EditorSocketIOServer が動かない問題 ref: https://qiita.com/hato/items/8ad93c0fde62a145d6db
var EditorSocketIOServer = require('ot/lib/editor-socketio-server');
/**
* ot.js patch for socket.io >= 1.0
* Copyright © 2012-2014 Tim Baumann, http://timbaumann.info
* Released under the MIT License, https://github.com/Operational-Transformation/ot.js/blob/master/LICENSE
*/
{
var EventEmitter = require('events').EventEmitter;
var TextOperation = require('ot/lib/text-operation');