Skip to content

Instantly share code, notes, and snippets.

View hidsh's full-sized avatar

yakshaver hidsh

View GitHub Profile
@hidsh
hidsh / emacs-test-emulate-key-input-and-exec-minibuffer.el
Last active April 5, 2023 20:30
elispでミニバッファに何か入力して実行するテスト
;; M-x ttt すると f2関数がコール
;; -> 自動でミニバッファに文字列を入力
;; -> 自動でEnter入力
;; -> 結果が表示される
(defun f2 ()
"ミニバッファに文字列を入力してEnterする。"
(insert "(1+ 5)")
(setq unread-command-events (listify-key-sequence "\C-j")) ;; Enterキー入力をエミュレート
;;(setq unread-command-events (listify-key-sequence (kbd "RET"))) ;; こっちでないとダメなときがある
@otaon
otaon / variadic_macro.c
Created March 23, 2019 13:06
C言語 - gccで可変長引数マクロを使用する方法
// gccでは...で表した可変長引数を__VA_ARGS__で指定できる
// 可変長引数を全て__VA_ARGS__とマップする
#define DEBUG_PRINT(...) printf(__VA_ARGS__); fflush(stdout)
// fmt以降の可変長引数を__VA_ARGS__とマップする
#define DEBUG_PRINT2(fmt, ...) printf(fmt, __VA_ARGS__); fflush(stdout)
// _1,_2,_3,の部分・・・引数の個数だけ用意する
// NAME・・・この部分に、目的の引数個数用の関数名が入る
#define GET_MACRO(_1,_2,_3,NAME,...) NAME
@y2q-actionman
y2q-actionman / a_road_to_common_lisp_jp.md
Last active June 20, 2025 20:31
A Road to Common Lisp 翻訳

この文章は、 Steve Losh 氏の記事 "A Road to Common Lisp" の翻訳です。

原文はこちらです: http://stevelosh.com/blog/2018/08/a-road-to-common-lisp/


A Road to Common Lisp (Common Lisp への道)

これまで、「最近のCommon Lispをどう学ぶとよいでしょう?」と助言を求めるメールをたくさん受け取ってきました。そこで私は、これまでメールやソーシャルメディアに投稿した全てのアドバイスを書き下すことにしました。これが誰かに有益ならば幸いです。

@mono0926
mono0926 / commit_message_example.md
Last active September 5, 2025 05:27
[転載] gitにおけるコミットログ/メッセージ例文集100
@hidsh
hidsh / prim-delay-test.c
Last active October 10, 2023 03:55
Cで一次遅れフィルタ
#include <stdio.h>
typedef short s2;
s2 primary_delay(s2 in, s2 old)
{
const s2 TS = 1; // sampling period[ms]
const s2 TAU = 100; // time constant[ms]
return (TS * in + TAU * old + TAU) / (TS + TAU);
@hidsh
hidsh / gistsearch.py
Last active December 17, 2015 01:48 — forked from narusemotoki/gistsearch.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# gistsearch.py
#
from urllib import urlopen
import json
import sys
import os
@narusemotoki
narusemotoki / gistsearch.py
Last active December 14, 2015 16:19
自分のGistを検索できないらしいので、ユーザ名とdescriptionに含まれていて欲しい文字列を引数で渡すと、引っかかったGistのdescriptionとURLを出力するスクリプト書いた。 指定したユーザのGistを全て持ってきてからdescriptionの中を見ていくので遅い。しかもすぐにAPI上限に届いてしまう。 $ python gistsearch narusemotoki python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from urllib import urlopen
import json
import sys
base_url = 'https://api.github.com/users/{username}/gists?page='
def fetch(username):
def fetch(page):
@rummelonp
rummelonp / faraday.md
Last active May 20, 2022 12:23
Ruby の HTTP クライアントライブラリ Faraday が便利そう

Ruby の HTTP クライアントライブラリ Faraday が便利そう

Ruby の HTTP クライアントライブラリ Faraday が便利そう

API ラッパの開発には [RestClient gem][rest_client_gem] だとか
OAuth の必要なものは [Net/HTTP][net_http] + [OAuth gem][oauth_gem] を使ってた

[Twitter gem][twitter_gem] や [Instagram gem][instagram_gem] など API ライブラリのソースを読んでみると
[Faraday gem][faraday_gem] というものがよく使われてた

@hidsh
hidsh / MathJax-jquery.html
Last active February 18, 2022 00:32
mathjax interactive preview
<!-- this document is fully based on MathJax-jquery.html by kurokigen. -->
<html>
<head>
<title>Live Preview of MathJax Type Setting</title>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [['$','$'], ["\\(","\\)"]] } });
</script>
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
@tetu1225
tetu1225 / gist:1086001
Created July 16, 2011 04:23
RubyでHashを構造体にしてアクセサのように取得する
def Struct(hash)
# ハッシュのキーを構造体のメンバーとして設定
st = Struct.new(*hash.keys)
# 構造体に新しい要素を突っ込む
st.new(
*hash.values.map do |s|
# ハッシュの場合は再帰
Hash === s ? Struct(s) : s
end