Skip to content

Instantly share code, notes, and snippets.

View hidsh's full-sized avatar

yakshaver hidsh

View GitHub Profile
@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
@hidsh
hidsh / death_march.md
Created February 10, 2022 12:41 — forked from voluntas/death_march.md
デスマーチが起きる理由 - 3つの指標

デスマーチが起きる理由 - 3つの指標

著者: 青い鴉(ぶるくろ)さん @bluecrow2

これは結城浩さんの運用されていた YukiWiki に当時 Coffee 様 (青い鴉(ぶるくろ)さん)がかかれていた文章です。 ただ 2018 年 3 月 7 日に YukiWiki が運用停止したため消えてしまいました。その記事のバックアップです。

今は 404 ですが、もともとの記事の URL は http://www.hyuki.com/yukiwiki/wiki.cgi?%A5%C7%A5%B9%A5%DE%A1%BC%A5%C1%A4%AC%B5%AF%A4%AD%A4%EB%CD%FD%CD%B3 になります。

昔、自分がとても感銘を受けた文章なので、このまま読めなくなるのはとてももったいないと思い、バックアップとして公開しています。

@hidsh
hidsh / node-args-test.js
Created January 24, 2022 16:26
nodeではargs[2]が最初の引数になる。
console.log(`arg length: ${process.argv.length}\n`);
for(let i=0; i<process.argv.length; i++){
console.log(`argv[${i}]: ${process.argv[i]}`);
}
console.log('\n※ nodeではargs[2]が最初の引数になる。');