Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
#
# adduser.sh
#
# usage: curl -fsSL $URL | bash -s -- <github-user-name> [<user-name>]
#
set -eux -o pipefail
main() {
local github="$1"
@takumakei
takumakei / main.dart
Last active June 23, 2021 13:30
How to disable ripple effect of TextButton
import 'dart:math' as math;
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@takumakei
takumakei / 1.go
Last active April 28, 2021 08:34
Goの(&[5]int{})[:]の実験
package main
import "fmt"
func main() {
a := [5]int{}
b := a[:]
fmt.Println(b)
}
// +build tools
package tools
import (
_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway"
_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2"
_ "google.golang.org/grpc/cmd/protoc-gen-go-grpc"
_ "google.golang.org/protobuf/cmd/protoc-gen-go"
)
#!/usr/bin/env sh
GOLANG_IMAGE="golang:1.14.4-alpine3.12"
cat <<EOF | docker run -i --rm -v ${PWD}:/build ${GOLANG_IMAGE} sh
apk add --no-cache gcc musl-dev git
git clone --shallow-since=2020/06/07 https://github.com/cosmos72/gomacro.git /go/src/github.com/cosmos72/gomacro
cd /go/src/github.com/cosmos72/gomacro
git checkout 647446f
env CGO_ENABLED=1 go install -tags netgo -installsuffix netgo --ldflags '-extldflags "-static"'
@takumakei
takumakei / sfinae.cpp
Last active August 29, 2015 14:24
SFINAE
#include <type_traits>
namespace sfinae {
template<bool b> using where = typename std::enable_if<b, std::nullptr_t>::type;
template<class A, class = std::nullptr_t>
struct case_t {
static char const* label() { return "cond-default"; }
};
@takumakei
takumakei / study-git-subtree.bash
Last active August 29, 2015 14:24
git subtreeを実際に動かして学ぶための教材
#!/bin/bash
WORK=$PWD
main() {
trap "exit 1" SIGINT
msg "git subtreeを実際に動かして学ぶための教材。" \
"適当なところに pause を仕掛けて" \
"ディレクトリ構造やgitの状態を覗き見して" \
@takumakei
takumakei / cbt
Last active August 29, 2015 14:24
cbt - CMake Build Tool
#!/bin/bash
#
# CMake Build Tool
#
# Copyright (c) 2015 takumakei
#
# This software is released under the MIT License.
# http://opensource.org/licenses/mit-license.php
#
# $Id: a58f8ef02f7aa5084af21a933965ec23fd75e60a $
@takumakei
takumakei / td-agent-hipchat.py
Last active August 29, 2015 14:22
Fluentd → HipChat
#!/usr/bin/env python
# coding: utf-8
#
# Copyright (c) 2015 TAKUMA Kei
#
# This software is released under the MIT License.
# http://opensource.org/licenses/mit-license.php
#
#
# HOW TO USE THIS SCRIPT:
// Copyright (C) 2011 RiSK (sscrisk)
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#if !defined(SSCRISK_DEMANGLE_HPP)
#define SSCRISK_DEMANGLE_HPP
#if defined(_MSC_VER) && _MSC_VER >= 1020
#pragma once