Skip to content

Instantly share code, notes, and snippets.

@takeru
takeru / ssh-agent-forward-tmux.md
Last active February 26, 2024 00:48
ssh-agent-forward tmux

et/vscodeでgit pullするとssh-agentがなんかへんなときがある

  • いにしえのscreen時代からのssh-agentが変にならない設定
    • なにしてるかわからん
  • moshがいいなってときもあったけどscreen->tmuxになって、いまはet+tmuxをつかってる
    • moshはagent-forward/port-forwardできないから
  • なんかへんなときがある
    • etつかってるとなんかへんなときがあるような
    • vscodeのターミナルも使いだして、なんかへんなときがふえたような?
  • てきとうに再接続してごまかしてる
@takeru
takeru / README.md
Last active December 19, 2022 23:35
nostr - Notes and Other Stuff Transmitted by Relays リレーで送信されるメモとその他のもの https://github.com/nostr-protocol/nostr/blob/a144619/README.md

nostr - Notes and Other Stuff Transmitted by Relays

The simplest open protocol that is able to create a censorship-resistant global "social" network once and for all.

検閲に強いグローバルな「ソーシャル」ネットワークを一挙に構築することができる最もシンプルなオープンプロトコルです。

It doesn't rely on any trusted central server, hence it is resilient; it is based on cryptographic keys and signatures, so it is tamperproof; it does not rely on P2P techniques, therefore it works.

信頼できる中央サーバーに依存しないので弾力性があり、暗号鍵と署名に基づくので改ざん防止になり、P2P技術に依存しないので機能するのです。

@takeru
takeru / switchbot_plug_onoff.sh
Last active July 25, 2022 05:40
SwitchBotPlugをcurlでオンオフ操作
# 0,10,20,30,40,50 * * * * /home/pi/switchbot_plug_onoff.sh on
# 2,12,22,32,42,52 * * * * /home/pi/switchbot_plug_onoff.sh off
#!/bin/bash
arg1="$1"
export SWITCHBOTDEVICEID=xxxxxxxxxxxx SWITCHBOTTOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
@takeru
takeru / delete_messages.py
Last active April 18, 2022 19:27 — forked from michimani/delete_messages.py
Delete old slack messages at a specific channel.
"""Delete old Slack messages at specific channel."""
from datetime import datetime
from time import sleep
import json
import re
import sys
import urllib.parse
import urllib.request
import os
@takeru
takeru / check_ping_or_reboot.sh
Last active April 24, 2022 23:47
pingだめならreboot
#!/bin/bash
#PING_HOST=192.168.0.1
PING_HOST=$1
if [ -z "$PING_HOST" ] ; then
logger "PING_HOST missing."
exit 1
fi
@takeru
takeru / shutdown_by_usb.service
Created January 20, 2022 03:32
ラズパイの右下のUSBになにか刺したらシャットダウンします〜
# /etc/systemd/system/shutdown_by_usb.service
[Unit]
Description=shutdown_by_usb
[Service]
Type=simple
ExecStart=bash -c 'while : ; do if [ -e /sys/bus/usb/devices/1-1.2 ] ; then echo "shutdown_by_usb!"; sleep 5; sudo shutdown -h now; sleep 60; else true; fi; sleep 1; $
Restart=always

Usage

curl -sSL https://gist.githubusercontent.com/ttimasdf/ef739670ac5d627981c5695adf4c8f98/raw/autossh@host1 | \
  sudo tee /etc/default/autossh@example
curl -sSL https://gist.githubusercontent.com/ttimasdf/ef739670ac5d627981c5695adf4c8f98/raw/[email protected] | \
  sudo tee /etc/systemd/system/[email protected]

sudo useradd -g nogroup -s /bin/false -m tunnel
sudo -u tunnel mkdir -p ~tunnel/.ssh # and copy your private key here
@takeru
takeru / pika_m5atomlite.ino
Created September 7, 2021 05:29
画面のピカピカにあわせてLEDもピッカピカ
// https://github.com/tanakamasayuki/ESP32LitePack/blob/master/examples/Quick/M5Stack/Core/M5AtomLite/M5AtomLite.ino
// https://github.com/tanakamasayuki/ESP32LitePack/blob/master/examples/Quick/M5Stack/Core/M5StickC/M5StickC.ino
//#include <M5Atom.h> // http://librarymanager/All#M5Atom https://github.com/m5stack/M5Atom
#include <FastLED.h> // http://librarymanager/All#FastLED https://github.com/FastLED/FastLED
const int NUM_LEDS = 120+60;
static CRGB leds[NUM_LEDS];
#define ATOM_LITE 1
#define STICK_C 2
@takeru
takeru / pikapika.ino
Last active September 4, 2021 21:49
pikapika m5atom lite fastled
//#include <M5Atom.h> // http://librarymanager/All#M5Atom https://github.com/m5stack/M5Atom
#include <FastLED.h> // http://librarymanager/All#FastLED https://github.com/FastLED/FastLED
const int NUM_LEDS = 120;
const int LED_PIN = 26;
static CRGB leds[NUM_LEDS];
void setup() {
// 初期化
//M5.begin(true, false, false); // (Serial, I2C, NeoPixel)
#
# Automatically generated file; DO NOT EDIT.
# Linux/arm64 4.9.119 Kernel Configuration
#
CONFIG_ARM64=y