Skip to content

Instantly share code, notes, and snippets.

View mizdra's full-sized avatar

mizdra mizdra

View GitHub Profile
@mizdra
mizdra / settings.json
Created October 26, 2022 03:14
.vscode
{
// UI
"editor.fontFamily": "RictyDiminished Nerd Font",
"editor.fontSize": 16,
"terminal.integrated.fontSize": 14,
"editor.wordWrap": "off",
"workbench.colorTheme": "Monokai",
"editor.minimap.enabled": false,
"editor.dragAndDrop": true,
"editor.renderControlCharacters": true,
@mizdra
mizdra / .dependency-cruiser.js
Last active December 27, 2021 05:42
The dependencies graph of eslint-interactive
/** @type {import('dependency-cruiser').IConfiguration} */
module.exports = {
options: {
exclude: {
path: '^src/(types|cli|util|typings)',
},
doNotFollow: {
path: 'node_modules',
dependencyTypes: ['npm', 'npm-dev', 'npm-optional', 'npm-peer', 'npm-bundled', 'npm-no-pkg'],
},
@mizdra
mizdra / git-sy
Last active October 1, 2021 05:02
リモートリポジトリとブランチを良しなに同期してくれる君
#!/usr/bin/env bash
# usage: git sy
set -e
# run に渡されたコマンドを実行しつつ、コマンドの名前をログに出力する
run() {
echo -e "\e[1m+$@\e[0m"
"$@"
}
@mizdra
mizdra / main.ino
Last active November 23, 2021 08:45
二酸化炭素濃度測定機 (M5StickC Plus + MH-Z19C)
// based https://gist.github.com/YujiSoftware/9274366a93f1ac7f9208bd4abf096527
#include <M5StickCPlus.h>
#include "MHZ19.h"
#define RX_PIN 36 // Rx pin which the MHZ19 Tx pin is attached to
#define TX_PIN 0 // Tx pin which the MHZ19 Rx pin is attached to
#define BAUDRATE 9600 // Device to MH-Z19 Serial baudrate (should not be changed)
#define LCD_MODE_DIGIT 0
@mizdra
mizdra / ghq.sh
Last active October 20, 2021 01:18
########################################
## peco
## (ref http://k0kubun.hatenablog.com/entry/2014/07/06/033336)
########################################
export GHQ_ROOT="$HOME/src"
# `cd ~gomi` でゴミ置き場に移動できるように
hash -d gomi=~/src/localhost/gomi
alias src-list="find ~/src -mindepth 3 -maxdepth 3 -type d | sed -e \"s|$HOME/src/||g\""
import React from 'react';
import TextField from '@material-ui/core/TextField';
import Button from '@material-ui/core/Button';
import Grid from '@material-ui/core/Grid';
import InputLabel from '@material-ui/core/InputLabel';
import { makeStyles } from '@material-ui/core/styles';
import useForm from 'react-hook-form';
const useStyles = makeStyles((theme) => ({
labelContainer: {
@mizdra
mizdra / index.tsx
Created August 21, 2019 08:16
`is` で絞込むやつ
type Modify<T, K extends keyof T, Value> = Pick<T, Exclude<keyof T, K>> &
{
[P in K]: Value
}
function isError<TData, TVariables>(
result: QueryResult<TData, TVariables>,
): result is Modify<typeof result, 'error', ApolloError> {
return !!result.error
}
@mizdra
mizdra / error.h
Last active August 3, 2019 16:38
Cでまともなエラーメッセージを出すマクロ (based on http://doi-t.hatenablog.com/entry/2013/12/10/094837)
#pragma once
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#define PANIC(fmt, ...) \
{ \
err_msg(__FILE__, __FUNCTION__, __LINE__, "panic", fmt, ##__VA_ARGS__); \
[[package]]
name = "cfg-if"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "itoa"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@mizdra
mizdra / 230.gif
Last active April 1, 2018 10:19
実行にはImageMagick, zshのインストールが必要です.
230.gif