Skip to content

Instantly share code, notes, and snippets.

View hidsh's full-sized avatar

yakshaver hidsh

View GitHub Profile
@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
@hidsh
hidsh / #log
Last active March 17, 2024 19:56
なんか、今日びのgccは個別に -c とかでコンパイルして最後にそいつらをリンクせんでも、1行でソースをコンパイル&リンクしてくれるっぽい
$ ls
Makefile a.out hogelib.c main.c
$ ./a.out
2
$
!!!!!!!!!!!!!まじか!!!!!!!
@hidsh
hidsh / wait-test.sh
Last active November 22, 2023 21:24
shell script example: wait sec
#!/usr/bin/sh
wait_sec=5
beg=`date +%s`
end=$(($beg + $wait_sec))
while [ `date +%s` -le $end ]; do
echo -n '.'
done
echo '\nend'