With administrative PowerShell
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
choco version
choco install python
python -V
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from contextlib import contextmanager | |
| import random | |
| class Prot: | |
| def __init__(self): | |
| pass | |
| @contextmanager | |
| def yoyo(self, hey): | |
| print('gacha.') # __enter__ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import os | |
| import platform | |
| import sys | |
| import webbrowser | |
| import functools | |
| import config |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import time | |
| class StopWatching(Exception): | |
| pass | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import random | |
| import webbrowser | |
| class Barista(): | |
| def __init__(self): | |
| with open('README.md') as beans: | |
| shops = [shop.split(" ") for shop in beans.readlines() if shop[0] == '-'] |
PowerShell の Invoke-Item で OS X の
open -a application.app filename.file
に相当することできるかなと思って調べたけど 関連するプログラムで開くだけで アプリケーションの指定はできないっぽかった でも
application filename.file
のでむしろ楽っぽい
関係ないけど PowerShell コマンドが短く出来てかいてておもしろい
touch 相当のことが
ni -it file -n text.txt
明示したいときもわかりやすくできるし Tab 補完されるのもうれしい
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CommandType Name ModuleName | |
| ----------- ---- ---------- | |
| Alias % -> ForEach-Object | |
| Alias ? -> Where-Object | |
| Alias ac -> Add-Content | |
| Alias asnp -> Add-PSSnapin | |
| Alias cat -> Get-Content | |
| Alias cd -> Set-Location | |
| Alias chdir -> Set-Location | |
| Alias clc -> Clear-Content |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo 'display notification "test" with title"title" subtitle"subtitle"' | osascript |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def life(self, times=4, first='*', last=None): | |
| yield first | |
| for _ in range(times): | |
| yield '*' | |
| if last is None: | |
| raise StopIteration | |
| yield last |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| import time | |
| a = '\-/|' | |
| while True: | |
| for _ in a: | |
| sys.stdout.write('\r{0}'.format(_)) | |
| sys.stdout.flush() | |
| time.sleep(0.1) | |