Skip to content

Instantly share code, notes, and snippets.

View hidsh's full-sized avatar

yakshaver hidsh

View GitHub Profile
@hidsh
hidsh / part-of-.zshrc
Last active December 24, 2024 01:00
show command help w/ fzf
h() {
local tmp_file=/tmp/h
local cmd=''
if [ "$#" -eq 0 ]; then
cmd=$(echo $PATH | tr ':' '\n' | xargs -I {} find {} -maxdepth 1 -type f -executable 2>/dev/nul
l | xargs -n 1 basename | fzf);
elif [ "$#" -eq 1 ]; then
cmd=$1
else
@hidsh
hidsh / sed-example.txt
Last active December 9, 2024 08:15
linux: sed で全置換
$rg --no-heading bat43 # check
rat43.zmk.yml:2:id: bat43
rat43.zmk.yml:5:url: https://kbd.dailycraft.jp/bat43/
Kconfig.shield:5: def_bool $(shields_list_contains,bat43)
$sed -i -e 's/bat43/rat43/' * # replace bat43 --> rat43
$rg --no-heading bat43 # confirm
$rg --no-heading rat43 # confirm
@hidsh
hidsh / rename-example.txt
Last active December 9, 2024 07:14
linux: renameコマンドなんてあったんや…
$ls -1
bat43.keymap
bat43.overlay
bat43.zmk.yml
Kconfig.defconfig
Kconfig.shield
$rename -n -v bat43 rat43 bat43* # dry run
`bat43.keymap' -> `rat43.keymap'
`bat43.overlay' -> `rat43.overlay'
@hidsh
hidsh / log-failed.txt
Last active December 8, 2024 15:38
error log, west build 1key shield
root@feb003495f7a:/workspaces/zmk-modules/zmk-modules/1key-zmk-shield# west build -s /workspaces/zmk/app -p -b seeeduino_xiao -- -DSHIELD=1key -DZMK_CONFIG=$PWD/config
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: /workspaces/zmk/app
-- CMake version: 3.30.0
-- Found Python3: /usr/bin/python3 (found suitable version "3.12.3", minimum required is "3.8") found components: Interpreter
-- Cache files will be written to: /root/.cache/zephyr
-- Zephyr version: 3.5.0 (/workspaces/zmk/zephyr)
-- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
-- ZMK Config directory: /workspaces/zmk-modules/zmk-modules/1key-zmk-shield/config
@hidsh
hidsh / PKGBUILD
Last active September 11, 2024 02:07
PKGBUILD for emacs-29.4
##emacs-29.3 Maintainer: Pedro A. López-Valencia <https://aur.archlinux.org/users/toropisco>
################################################################################
# CAVEAT LECTOR: This PKGBUILD is highly opinionated. I give you
# enough rope to hang yourself, but by default it
# only enables the features I use.
#
# TLDR: yaourt users, cry me a river.
#
# Everyone else: do not update blindly this PKGBUILD. At least
@hidsh
hidsh / README.md
Last active July 22, 2024 03:49
arduino example: calling Serial.println() from a C source file

C言語からArduinoのSerialオブジェクトを使うには

  1. C++のソースにSerialオブジェクトを使ったラッパー関数を作る (my_log() @sub.cpp)
  2. Cのソースからそのラッパー関数をコールするラッパー関数を作る (my_log_c() @sub.c)

という、二段構えのラップラップが必要になる。

C++から直接Serialオブジェクトを使うときに比べてめんどいけど、このやり方を覚えるとArduinoだけでなく他の言語でも使えるので応用が効くはず。

元ネタ:https://stackoverflow.com/questions/66632376/how-to-call-serial-print-from-c-file-in-arduino-ide

@hidsh
hidsh / serial-print-from-cpp.ino
Created July 22, 2024 03:11
arduino example: calling Serial.println() from a C++ source file
#include "sub.h"
void setup(){
Serial.begin(9600);
delay(0.5 * 1000);
my_log("foo");
}
void loop(){
@hidsh
hidsh / #fix.sh
Last active March 25, 2024 00:38
suppress evil-ex warnings at starupt emacs
#!/usr/bin/sh
patch evil-ex.el evil-ex.patch
@hidsh
hidsh / #fix.sh
Last active March 25, 2024 00:11
suppress undo-tree warning at startup emacs
#!/usr/bin/sh
patch undo-tree.el undo-tree.el.patch
@hidsh
hidsh / #fix.sh
Last active March 25, 2024 00:10
suppress mozc warning at startup emacs
#!/usr/bin/sh
patch mozc.el mozc.el.patch