Skip to content

Instantly share code, notes, and snippets.

Avatar
🛴
Man's soil is still rich enough to direct his own life.

Ryota Bannai RyotaBannai

🛴
Man's soil is still rich enough to direct his own life.
View GitHub Profile
@RyotaBannai
RyotaBannai / usePrompt.tsx
Created Aug 2, 2020 — forked from sibelius/usePrompt.tsx
Prompt user before leaving route or reload
View usePrompt.tsx
import { useEffect, useRef } from 'react';
import { useHistory } from 'react-router-dom';
export const usePrompt = (when: boolean, message: string = 'Are you sure you want to quit without saving your changes?') => {
const history = useHistory();
const self = useRef(null);
const onWindowOrTabClose = event => {
if (!when) {
@RyotaBannai
RyotaBannai / README.md
Created Jun 21, 2020 — forked from Tynael/README.md
How to use npx to run gist based scripts
View README.md
@RyotaBannai
RyotaBannai / type-bounds.scala
Created Apr 15, 2020 — forked from retronym/type-bounds.scala
Tour of Scala Type Bounds
View type-bounds.scala
class A
class A2 extends A
class B
trait M[X]
//
// Upper Type Bound
//
def upperTypeBound[AA <: A](x: AA): A = x
@RyotaBannai
RyotaBannai / git-reflog.md
Created Jan 22, 2020 — forked from kymmt90/git-reflog.md
`git reflog` についてまとめてみる
View git-reflog.md

git reflog についてまとめてみる

reflog とは

  • reflog(参照ログ)とは HEAD やブランチ先端の動きの履歴
    • 各個人のローカルリポジトリに存在
    • ブランチの切り替え、新たに加えられた変更のプル、履歴の書き換え、あるいは単なる新規コミットの実行などを記録
  • git reflog で HEAD の移動履歴を、git reflog <ブランチ名> でそのブランチ先端が指していたコミットの一覧を確認可能
    • HEAD@{5}: HEAD の五つ前の状態を示す
View Activate Office 2019 for macOS VoL.md

Activate MS Office 2019/2016 for macOS - Microsoft_Office_2019_VL_Serializer

Office 2019 above

2019-06-03

Note that Office2019 DO NOT support activate via simple copy/paste plist license file which is the simplest way to activate Office 2016. Fortunately, you can also use the VL Serializer tool, just install Office 2019 and Serializer, then run Serializer to activate.

Ref

@RyotaBannai
RyotaBannai / mlp.py
Last active Feb 5, 2019 — forked from miloharper/main.py
A two layer neural network written in Python, which trains itself to solve a variation of the XOR problem.
View mlp.py
from numpy import exp, array, random, dot, reshape
from autograd import grad
class NeuronLayer():
def __init__(self, neuron_n, inputs_n):
self.weights = 2 * random.random((inputs_n, neuron_n)) - 1
class NeuralNetwork():
def __init__(self, layer1, layer2):
self.layer1 = layer1
View cooksd_n_dffits_w_sm.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View cooksd.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View dffits.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View leverage_data.py
c=['#415952', '#f35134', '#243AB5']
def dataset_ (n=200, idx_outlier=0, ydistance=5):
rng = np.random.RandomState(4)
data = np.dot(rng.rand(2, 2), rng.randn(2, n)).T
data[idx_outlier:idx_outlier+1,1] = ydistance
return data
N=200
inx=10
i = dataset_(N, inx)
You can’t perform that action at this time.