Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:
Writing in Haskell, TypeScript, or Power Automate

YAMAMOTO Yuji igrep

:shipit:
Writing in Haskell, TypeScript, or Power Automate
View GitHub Profile
@mrtry
mrtry / check-xcode-version.sh
Created May 21, 2021 08:53
.xcode-versionと一致してるかをチェックするスクリプト
View check-xcode-version.sh
# Project rootに移動
cd $(git rev-parse --show-toplevel)
if [ "$(cat .xcode-version)" != "$(xcodebuild -version | awk 'NR==1{print $2}')" ]; then
echo 'Invalid Xcode version'
echo ".xcode-version: $(cat .xcode-version)"
echo "xcodebuild version: $(xcodebuild -version | awk 'NR==1{print $2}')"
exit 1
fi
@mrtry
mrtry / Gemfile
Last active May 23, 2021 10:49
Bump version for react-native
View Gemfile
# android/ ios/ に配置
source "https://rubygems.org"
fastlaneVersion = File.join(File.dirname(__FILE__), '../fastlane-version')
eval_gemfile(fastlaneVersion) if File.exist?(fastlaneVersion)
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)
@mrtry
mrtry / post-checkout
Created May 19, 2021 12:11
run `npm install` when update package.json
View post-checkout
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
prevHEAD=$1
nextHEAD=$2
prevPackageHash=$(git log --format="%C(auto)%h%Creset" -n 1 $prevHEAD -- package.json | cat)
nextPackageHash=$(git log --format="%C(auto)%h%Creset" -n 1 $nextHEAD -- package.json | cat)
if [ "$prevPackageHash" != "$nextPackageHash" ]; then
@mengwangk
mengwangk / compe.lua
Last active January 10, 2022 01:57
Neovim LSP Enhanced - compe.lua
View compe.lua
-- Configuration for nvim-compe
local utils = require('utils')
vim.cmd [[set shortmess+=c]]
utils.opt('o', 'completeopt', 'menuone,noselect')
require'compe'.setup {
enabled = true;
autocomplete = true;
@mengwangk
mengwangk / init.lua
Created March 13, 2021 13:14
Neovim LSP Enhanced - init.lua
View init.lua
local on_attach = function(client, bufnr)
-- require('completion').on_attach()
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings.
@wataash
wataash / linux-esp-decryption.hs
Last active September 1, 2020 06:36
linux L2TP/IPsec ESP decryption
View linux-esp-decryption.hs
$ sudo ip xfrm state
↓ info for local→remote direction IPsec tunnel(ESP)
src 192.168.0.2 dst 10.0.0.1
proto esp spi 0xaaaaaaaa reqid 1 mode transport
replay-window 0
auth-trunc hmac(sha1) 0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 96
enc cbc(aes) 0xcccccccccccccccccccccccccccccccccccccccccccccccccccccccc
encap type espinudp sport 4500 dport 4500 addr 0.0.0.0
anti-replay context: seq 0x0, oseq 0xaab, bitmap 0x00000000
sel src 192.168.0.2/32 dst 10.0.0.1/32
@bushidocodes
bushidocodes / wasm-summit-2020-notes.md
Last active July 30, 2020 23:47
WebAssembly Summit 2020 Notes
View wasm-summit-2020-notes.md

WebAssembly Summit 2020

https://webassembly-summit.org/

Lin Clark's Talk - "WebAssembly Nanoprocess"

https://www.youtube.com/watch?v=IBZFJzGnBoU

  • the missing functionality alongside WASI and Interface Types is something that provides "capability-based security".
  • Delegation of permissions to propagate down transitive dependencies
  • plan to use fine-grain form of per-module virtualization
  • A "WebAssembly nanoprocess" is just wasm, but follows a particular pattern.
@chrisdone
chrisdone / Intro.md
Last active February 1, 2023 08:52
Statically checked overloaded strings
View Intro.md

Statically checked overloaded strings

This gist demonstrates a trick I came up with which is defining IsString for Q (TExp a), where a is lift-able. This allows you to write $$("...") and have the string parsed at compile-time.

On GHC 9, you are able to write $$"..." instead.

This offers a light-weight way to enforce compile-time constraints. It's basically OverloadedStrings with static checks. The inferred return type

View pandoc-pptx-template.py
#!/usr/bin/env python3
import zipfile
import sys
import re
import xml.etree.ElementTree as ET
namespaces = {
'a': 'http://schemas.openxmlformats.org/drawingml/2006/main',
'r': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',
@HirotoShioi
HirotoShioi / overview.md
Last active May 15, 2019 02:43
Overview
View overview.md

Quickcheckの極意

QuickCheckで可能となる様々なテスト手法

  • Model based test
  • Metamorphic test
  • Postconditions
  • Round-trip test

テストをデバッグしよう

  • 有効なテストがどの程度の頻度で行われているのか確認しよう。(例:リストに存在しない値に対するlookupがテストの大半を占めていないか)