Skip to content

Instantly share code, notes, and snippets.

View hidsh's full-sized avatar

yakshaver hidsh

View GitHub Profile
@hidsh
hidsh / my-assert.el
Last active April 4, 2023 18:53
my assersion macro
;; 関数のトップレベルでしか動作しないので注意
(defmacro my-assert (form)
`(let* ((backtrace (backtrace-frame 2))
(func-name (nth 1 backtrace)))
(unless ,form (error "Assert in %s(): should be %S" func-name ',form))))
@hidsh
hidsh / soatari_pro_micro_5.ino
Created February 28, 2023 06:22
arduino: soatari-matrix test pgm for sparkfun's pro micro
// soatari-matrix test for pro micro
// マトリクスのテスト RC1..RC3を順ぐりにLO出力にして、LO出力以外のRCxを入力にしてSWxxをセンスする
// マトリクスが変化したときのAD値を表示する
// 7 8 9 <-- pin number
// RC1 RC2 RC3
// ----------------
// - , SW12, SW13
// SW21, - , SW23
// SW31, SW32, -
@hidsh
hidsh / my-consult-ripgrep.el
Created January 2, 2023 03:25
elisp: consult-ripgrep with symbol-at-point and directory to search
(defun my-consult-ripgrep (&optional parg dir initial)
"`consult-ripgrep` with symbol-at-point.
Besides, it can be Specified top directory to search using prefix-argument, e.g. C-u."
(interactive "p")
(setq initial (thing-at-point 'symbol))
(setq dir (pcase parg
(1 nil) ;; not given prefix-arg
(t (let ((insert-default-directory t))
(read-directory-name "Ripgrep Dir: ")))))
(consult-ripgrep dir initial)))
@hidsh
hidsh / mk-fukugen-point.ps1
Created July 8, 2022 02:52
コマンドライン(powershell)で Windows 10 の復元ポイントを作成
# コマンドライン(powershell)で Windows 10 の復元ポイントを作成
#
$comment = Read-Host "コメント"
if([string]::IsNullOrEmpty($comment)) {
$comment = "変更"
}
#Write-Output $comment
@hidsh
hidsh / cutting-sheet-mba13-2020.svg
Last active April 9, 2022 07:34
Old fashioned Octocat Sticker for Macbook Air M1 2020
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#include <stdio.h>
#include <assert.h>
int x = 10;
int main(void)
{
assert(x < 5);
printf("assert test\n");
#include <stdio.h>
#include <stdlib.h> // abort
int main(void)
{
printf("start\n");
abort();
printf("end\n");
@hidsh
hidsh / picoprog.sh
Last active March 20, 2022 12:26
trivial shell script to program into raspberry pi pico using openocd
#!/bin/sh
PGM='openocd'
if [ $# != 1 ]; then
echo "USAGE: $(basename $0) ELF_PATH"
exit -1;
fi
if [ ! $(which $PGM) ]; then
vm-ubuntu:~$ mkdir pico
vm-ubuntu:~$ cd pico
vm-ubuntu:~/pico$ git clone --recursive https://github.com/raspberrypi/pico-sdk.git
Cloning into 'pico-sdk'...
Warning: Permanently added the ECDSA host key for IP address '13.114.40.48' to the list of known hosts.
remote: Enumerating objects: 4766, done.
remote: Counting objects: 100% (1217/1217), done.
remote: Compressing objects: 100% (436/436), done.
remote: Total 4766 (delta 1006), reused 794 (delta 769), pack-reused 3549
Receiving objects: 100% (4766/4766), 2.13 MiB | 3.11 MiB/s, done.
@hidsh
hidsh / current_source.js
Created February 13, 2022 03:12
innerHTML で表示変更した時にソース表示するには?
// ↓これをChrome のコンソールに入力して、結果をコピー
console.log(document.getElementsByTagName('html')[0].innerHTML);
// 元ネタ: ↓ここのNo.3の回答
// https://oshiete.goo.ne.jp/qa/6191173.html