Skip to content

Instantly share code, notes, and snippets.

View hidsh's full-sized avatar

yakshaver hidsh

View GitHub Profile
@hidsh
hidsh / README.md
Last active January 23, 2022 15:06
raspberry pi 対策:長時間操作がないとwifiが切れる

対策:長時間操作がないとwifiが切れる

  1. ~/reconnect.sh に置く

  2. 1分おきに実行するように crontab -e して次を貼り付け

# disalble syslog from cron '(CRON) info (No MTA installed, discarding output)'
MAILTO=""
@hidsh
hidsh / motd-pi-zero.sh
Created January 23, 2022 12:55
My motd
#!/bin/sh
# output by `figlet Pi zero'
# try `showfigfonts Pi zero' to choose another font!
echo "\e[33m
____ _ \e[1m\e[32mYou've logged into:\e[33m
| _ \(_) _______ _ __ ___
| |_) | | |_ / _ \ '__/ _ \
| __/| | / / __/ | | (_) |
|_| |_| /___\___|_| \___/
@hidsh
hidsh / ping-parallel.sh
Last active January 22, 2022 15:07
Mac: アドレス範囲(192.168.1.1〜254)をpingする
#!/bin/sh
base=192.168.1
#beg=1
#end=254
# Mac (Mac's ping command has some different options (e.g. -i) than that of Linux?)
echo ${base}.{1..254} | xargs -P999 -n1 ping -c1 -t1 -i2| grep ttl
@hidsh
hidsh / README.md
Last active January 23, 2022 00:23
Python: CUIでGitHubの草画像をSlackに投稿する

slack-post-github-grass

CUIでSlackに草画像を投稿します。

投稿先のワークスペースはこちら → 招待リンク

Install

$ cd /usr/local/bin # とか PATH の通ったところに移動
@hidsh
hidsh / mixin-example.py
Created January 17, 2022 12:31
python ミックスインの例
class BaseMixin:
"""ミックスインなので自身のインスタンス化を禁止"""
def __init__(self):
raise Exception('This is Mixin, thus cannot be instantiated itself.')
class SpeakMixin(BaseMixin):
"""発言用のspeakメソッドを定義"""
def speak(self, s):
print(f'{self.name}: {s}');
@hidsh
hidsh / default-main.js
Last active October 7, 2022 05:12
js のexport / import をローカルで確認( export default class編)
'use strict';
import Hoge from './default-sub.js';
let hoge = new Hoge();
hoge.print();
@hidsh
hidsh / todo と打ち消し線.md
Last active January 1, 2022 13:14
gfm テスト

基本

~~hoge~~ hoge

- [ ] hoge

  • hoge

OK

~~- [ ] hoge fuga~~

  • hoge fuga
@hidsh
hidsh / button-disabled.html
Created December 14, 2021 16:09
Bulma Example
<!doctype html>
<html lang="ja">
<head>
<title>Bulma Test</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css">
</head>
<body>
<button class="button is-primary" id="target" onclick="console.log('pressed')">target</button>
<button class="button is-danger" onclick="disableButton()">Diable</button>
<button class="button is-info" onclick="enableButton()">Enable</button>
@hidsh
hidsh / .bashrc-mymod.sh
Last active January 23, 2022 15:57
.bashrc に毎回付け足すのやその他のドットファイルなど
################################################
# unnbind key C-s, C-q in terminal
if [[ -t 0 ]]; then
stty stop undef
stty start undef
fi
# bind key Alt-h <- backward-kill-word
stty werase undef
@hidsh
hidsh / ubuntu-ver.sh
Last active July 9, 2022 08:12
Ubuntu のバージョンを調べるのに毎回5万回ほどググってさすがに嫌になったのでシェルスクリプトにしとく。
#!/usr/bin/sh
ubuntu_version() {
echo `cat /etc/lsb-release |grep -oP '(?<=").+(?=")'`
}
echo `ubuntu_version`