Skip to content

Instantly share code, notes, and snippets.

@elzup
elzup / gh-pages.yml
Created October 9, 2019 02:40
GithubActions gh-pages deploy
name: GitHub Pages
on:
push:
branches:
- master
jobs:
build-deploy:
@elzup
elzup / trump.js
Created September 25, 2019 07:08
trump flowtype
// @flow
type Color = 'red' | 'black';
const RED = 'red';
const BLACK = 'black';
type Mark = {|name: string, color: Color|};
const SPADE: Mark = {name: 'S', color: BLACK};
const HEART: Mark = {name: 'H', color: RED};
const CLUB: Mark = {name: 'C', color: BLACK};
#!/bin/bash
adb kill-server
adb start-server
tcpip_port="5555"
adbip=`adb shell netcfg |grep wlan0 |egrep -o '(\d{1,3}\.){3}(\d{1,3})'`
adb tcpip $tcpip_port
adb connect $adbip:$tcpip_port
#include <Arduino.h>
#include <ESP8266WiFi.h>
#define N 36
extern "C" {
#include "user_interface.h"
}
int c = 16;
@elzup
elzup / has31.js
Created March 31, 2019 03:40
Does month have 31days
const has31 = month => Boolean((month & 1) ^ ((month >> 3) & 1))
test('1-12', () => {
expect(has31(1)).toMatchInlineSnapshot(`true`)
expect(has31(2)).toMatchInlineSnapshot(`false`)
expect(has31(3)).toMatchInlineSnapshot(`true`)
expect(has31(4)).toMatchInlineSnapshot(`false`)
expect(has31(5)).toMatchInlineSnapshot(`true`)
expect(has31(6)).toMatchInlineSnapshot(`false`)
expect(has31(7)).toMatchInlineSnapshot(`true`)
const has31 = month => Boolean((month & 1) ^ ((month >> 3) & 1))
test('1-12', () => {
expect(has31(1)).toMatchInlineSnapshot(`true`)
expect(has31(2)).toMatchInlineSnapshot(`false`)
expect(has31(3)).toMatchInlineSnapshot(`true`)
expect(has31(4)).toMatchInlineSnapshot(`false`)
expect(has31(5)).toMatchInlineSnapshot(`true`)
expect(has31(6)).toMatchInlineSnapshot(`false`)
expect(has31(7)).toMatchInlineSnapshot(`true`)
@elzup
elzup / wbgt.js
Last active March 4, 2019 08:28
Approximate wbgt: 近似暑さ指数(WBGT)計算式
function awbgt(tmp, hmd) {
return (
(hmd - 20) * (Math.pow(tmp - 40, 2) * -0.00025 + 0.185) +
(11 / 15) * (tmp - 25) +
17.8
)
}
@elzup
elzup / domainlist-price-sorted.txt
Last active February 7, 2019 07:41
route53 で購入できるドメインの価格順ソートリスト https://qiita.com/elzup/items/caf5e0b833d2f02d90fe
.me.uk - $8
.co.uk - $9
.de - $9
.be - $9
.name - $9
.org.uk - $9
.uk - $9
.click - $10
.es - $10
.link - $10
@elzup
elzup / flow-to-ts-renamer.sh
Created January 3, 2019 01:46
.js to .ts with 75lb/renamer
n
@elzup
elzup / 付き合って
Created December 27, 2018 03:41
sudo ./付き合って
#!/bin/sh
[ $USER = "root" ] && echo "オッケー" || echo "ごめん無理"