Skip to content

Instantly share code, notes, and snippets.

View devlights's full-sized avatar
🤧
hay fever....

devlights devlights

🤧
hay fever....
View GitHub Profile
@devlights
devlights / pyinstaller_useful_options.md
Created March 20, 2019 02:34
[python] PyInstaller で よく指定するオプション

コマンド

pyinstaller xxxx.py --onedir --onefile --noconsole --clean

オプションの意味

  • --onedir or -D
  • 出力を1ディレクトリにまとめる
@devlights
devlights / nkf_euc-jp_lf.md
Created February 18, 2019 04:34
[linux] nkf で 文字コードを euc-jp にして、改行コードを LF に変換
$ nkf -Se -Lu --in-place /path/to/file
@devlights
devlights / cygwin_lv_oops.md
Last active February 18, 2019 02:02
[cygwin] lv コマンドを実行すると行の先頭に "OOPS" と付く件

TERM環境変数をcygwinにすればちゃんと表示できる

$ TERM=cygwin lv /path/to/file

alias 設定しておいたらいい感じ

alias lv='TERM=cygwin lv'
@devlights
devlights / cygwin_gnupack_connect_euc-jp_ssh.md
Last active February 14, 2019 03:08
[cygwin][gnupack] ssh で 文字コード が EUC-JP なホストに接続
$ cocot -t UTF-8 -p EUC-JP -- ssh xxx@xxxx
@devlights
devlights / cygwin_open_explorer.md
Created February 13, 2019 03:55
cygwin で エクスプローラー を開く (cygstart)
@devlights
devlights / ls_command_sort_latest_timestamp.md
Created February 11, 2019 06:42
[linux][mac] ls コマンドで日付が最も直近のN件を表示
$ ls -ltr | tail -n 3
@devlights
devlights / CommandLineParserSample.cs
Last active December 18, 2018 05:16
[C#] コマンドラインオプションを扱う (CommandLine ライブラリ)
using System;
using CommandLine;
namespace CommandLineArg
{
class Program
{
public class Options
{
// shortnameで短いオプション名。(-v)longnameで長いオプション名を指定できる。(--versioninfo)
@devlights
devlights / asyncio_evloop_producer_consumer.py
Created November 21, 2018 08:57
[python][asyncio] Producer-Consumerパターンのサンプル
"""
asyncio のサンプルです。
asyncio.Queueを使った producer-consumer パターンのサンプル。
"""
import asyncio
import contextlib
import itertools
import random
@devlights
devlights / asyncio_evloop_wait.py
Created November 21, 2018 08:54
[python][asyncio] asyncio.waitを用いたサンプル
import asyncio
async def factorial(id: int, number: int):
f = 1
for i in range(2, number + 1):
print(f'[{id}]: compute {i} ...')
await asyncio.sleep(1)
f *= i
print(f'[{id}]: factorial {number} = {f}')
@devlights
devlights / asyncio_evloop_thread.py
Last active February 17, 2023 08:14
[python][asyncio] イベントループを別スレッドで動作させてメインスレッドは生かすサンプル
# ------------------------------------------------
# イベントループを別スレッドで動作させて
# メインスレッドは生かすサンプル
#
# asyncio をつかった処理にて、別スレッドから
# イベントスレッドに対して処理を行う場合
# イベントスレッド自体がスレッドセーフではないため
# 専用のメソッドを利用する必要がある
#
# - ev_loop.call_soon_threadsafe()