Skip to content

Instantly share code, notes, and snippets.

View tamuhey's full-sized avatar
🏠
Working from home

Yohei Tamura tamuhey

🏠
Working from home
View GitHub Profile
@tamuhey
tamuhey / test.ipynb
Last active August 26, 2018 04:46
test
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tamuhey
tamuhey / jupyter_shortcuts.md
Created September 26, 2018 13:16 — forked from kidpixo/jupyter_shortcuts.md
Keyboard shortcuts for ipython notebook 3.1.0 / jupyter

Toc

Keyboard shortcuts

The IPython Notebook has two different keyboard input modes. Edit mode allows you to type code/text into a cell and is indicated by a green cell border. Command mode binds the keyboard to notebook level actions and is indicated by a grey cell border.

MacOS modifier keys:

  • ⌘ : Command
@tamuhey
tamuhey / file0.txt
Last active December 19, 2018 13:59
量子アニーリングで数独を解く ref: https://qiita.com/tamurahey/items/b0e919071e7e19acd494
pip install dwave-qbsolv
@tamuhey
tamuhey / pytorch_earlystop.py
Created December 26, 2018 02:27
Pytorch Early Stop Class
import torch as to
import torch.nn as nn
class EarlyStop:
"""Check early stop, and save best params
Examples:
>>> e=EarlyStop(10)
@tamuhey
tamuhey / random_seq_generator.py
Created January 6, 2019 08:35
Random sequence generator in Python
def random_generator(step=None):
step = step or random.randint(1e4, 1e5)
for c in count():
for i in random.sample(range(c*step, (c+1)*step), step):
yield i
@tamuhey
tamuhey / sudo.ps1
Created March 24, 2019 07:56
Sudo for Powershell
function sudo()
{
if ($args.Length -eq 1)
{
start-process $args[0] -verb runAs
}
if ($args.Length -gt 1)
{
start-process $args[0] -Args "-executionpolicy bypass -command Set-Location \`"$PWD\`"; $($args[1..$args.Length])" -verb runAs
}
@tamuhey
tamuhey / touch.ps1
Created March 25, 2019 02:31
`touch` for Powershell
function touch(){ new-item $args[0] -itemtype file }
@tamuhey
tamuhey / cd-gitroot.sh
Last active March 27, 2019 02:01
cd to git root directory in bash
function cd-gitroot(){
cd $(git rev-parse --show-toplevel)
}
@tamuhey
tamuhey / measure_profile.ps1
Created March 28, 2019 01:57
measure import time for all profiles
$profile.psobject.properties | where { $_ -is [psnoteproperty] } | foreach { echo $_.value; Measure-Command { . $_
.value }}
@tamuhey
tamuhey / ln-s.ps1
Created March 28, 2019 02:40
Create symlink in powershell, without root
function ln-s() {
cmd /c mklink $args[0] $args[1]
}