Skip to content

Instantly share code, notes, and snippets.

View shiro-t's full-sized avatar

SHIROYAMA Takayuki shiro-t

View GitHub Profile
@shiro-t
shiro-t / disable_terminal_mouse_reporting
Last active May 13, 2022 02:19
Terminal.app in macOS Monterey enables 'Mouse Reporting' by default in each terminal window. This script checks whether the feature is enabled or not and disables it when enabled.
#!/usr/bin/osascript
set MENU_OF_ALLOW_MOUSE_REPORTING to 12
set MENU_OF_VIEW to 5
set SHORTCUT_KEY_OF_ALLOW_MOUSE_REPORTING to "r"
tell application "System Events"
tell process "Terminal"
-- for debugging
-- set n to name of menu item MENU_OF_ALLOW_MOUSE_REPORTING of menu 1 of menu bar item MENU_OF_VIEW of menu bar 1
#! /usr/bin/env python3
import re
import os
import sys
import time
pattern = re.compile(br'^#(\d+)$')
out = sys.stdout.buffer
@shiro-t
shiro-t / wtmpdump.c
Last active December 2, 2019 10:34
read linux's wtmp file on my macOS
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <strings.h>
#include <sys/time.h>
#define EMPTY 0 /* Record does not contain valid info (formerly known as UT_UNKNOWN on Linux) */
#define RUN_LVL 1 /* Change in system run-level (see init(8)) */
#define BOOT_TIME 2 /* Time of system boot (in ut_tv) */
#define NEW_TIME 3 /* Time after system clock change (in ut_tv) */
[Unit]
Description=OpenBSD Secure Shell server Altnative
After=network.target auditd.service sshd.service
[Service]
EnvironmentFile=-/etc/default/ssh
ExecStartPre=/bin/sh -c '[ ! -f "/usr/sbin/sshd2nd" -o "/usr/sbin/sshd" -nt "/usr/sbin/sshd2nd" ] && cp /usr/sbin/sshd /usr/sbin/sshd2nd ; /usr/sbin/sshd2nd -t'
ExecStart=/usr/sbin/sshd2nd -f /etc/ssh/sshd2nd_config -D $SSHD_OPTS
ExecReload=/usr/sbin/sshd2nd -t
ExecReload=/bin/kill -HUP $MAINPID
@shiro-t
shiro-t / init.lua
Last active May 8, 2023 05:22
My init.lua
-- disable all settings
local passthrough = {}
-- default key mappings
local defaultKeyMapper = {
{{"ctrl"}, 'a', {'ctrl'}, 'left' },
{{"ctrl"}, 'b', {}, 'left' },
{{"ctrl"}, 'e', {'ctrl'}, 'right' },
{{"ctrl"}, 'f', {}, 'right' },