Skip to content

Instantly share code, notes, and snippets.

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

devlights devlights

🤧
hay fever....
View GitHub Profile
@jtriley
jtriley / terminalsize.py
Created July 26, 2011 21:58
Get current terminal size on Linux, Mac, and Windows
#!/usr/bin/env python
import os
import shlex
import struct
import platform
import subprocess
def get_terminal_size():
""" getTerminalSize()
@devlights
devlights / test.py
Last active August 10, 2022 03:00
Pythonでマルチバイト文字を扱う際に気をつける点。
# vim:fileencoding=utf-8
import codecs
import sys
import types
if __name__ == '__main__':
#
# ターミナルに出力する場合
# 以下のサンプルは、ターミナルに出力する場合は
# うまくいくが、リダイレクトさせてファイルに出力すると
@pocketberserker
pocketberserker / AsyncInCSharpAndFSharp.ja.rst
Last active October 6, 2022 02:53
Async in C# and F#: Asynchronous gotchas in C# (Japanese translation)

C# と F# の Async: C# の非同期の落とし穴

原文:Async in C# and F#: Asynchronous gotchas in C#
原文著者:Tomas Petricek (@tomaspetricek)
翻訳者:@pocketberserker

2月に、私は毎年恒例のMVPサミット ── Microsoft が MVP のために主催するイベント ── に出席しました。私はボストンとニューヨークを訪問する機会を利用して、二つの F# に関する講演と Channel9 lecture about type providers の収録を行いました。他のすべての活動(しばしばパブで他の F#er を議論に巻き込んだり、朝まで長い睡眠)にもかかわらず、私はいくつかの講演に参加し果せました。

@tekk555
tekk555 / km-e0010411.ini
Created August 16, 2013 12:39
XRDP用日本語キーボードレイアウトファイル http://www.mail-archive.com/xrdp-devel@lists.sourceforge.net/msg00263.html
[noshift]
Key8=0:0
Key9=65307:27
Key10=49:49
Key11=50:50
Key12=51:51
Key13=52:52
Key14=53:53
Key15=54:54
Key16=55:55
@tekk555
tekk555 / gist:6249920
Last active December 21, 2015 04:29
XRDPのインストール。日本語対応。\_IMEに対応。Ubuntu Server 12.04 LTS。 要 Ubuntu Desktop。 xrdp 0.6
# とりあえず標準RPMをインストールする。後でコンパイルしたモジュールで上書きする。
$ sudo apt-get install xrdp
# コンパイルに必要なライブラリを追加
$ sudo apt-get install make
$ sudo apt-get install autoconf
$ sudo apt-get install libtool libtool-doc
$ sudo apt-get install libssl-dev
$ sudo apt-get install libpam0g-dev
$ sudo apt-get install libx11-dev and libxfixes-dev
@smurn
smurn / paramiko291monkeypatch.py
Created July 17, 2014 09:04
Monkey patch for paramiko issue 291
"""
Add binary-mode options to SSHClient.exec_command(...) for binary stdout, stderr channels.
See: https://github.com/paramiko/paramiko/issues/291
"""
import paramiko
def _patched_exec_command(self,
@voluntas
voluntas / webrtc.rst
Last active June 27, 2024 02:25
WebRTC コトハジメ
@Linrstudio
Linrstudio / hello-apple.md
Created October 20, 2015 06:44
solutions for window.innerWidth / innerHeight issue in iOS9

iOS9 returns double the value for window.innerWidth & window.innerHeight
The versions that are concerned are: 9.0.0, 9.0.1, 9.0.2

A few people got mad on twitter:

window.innerWidth in iOS 9 Safari returns double the number it did in iOS 8? Is this real life? tell me no — @rachsmithtweets
iOS9 Safari has the most insane bug where window.innerWidth / innerHeight is *sometimes* twice as large as it should be. ughhhh. !? — @mattdesl

iOS9 innerWidth/innerHeight is having a lot of fun these days — @ayamflow

@pfreixes
pfreixes / Gevent vs asyncio with libuv.md
Last active May 16, 2021 08:17
Gevent vs asyncio with libuv

The numbers claimed by this benchamark about Gevent [1] comparaed with the numbers got by Asyncio with the uvloop and even with the default loop has left me a bit frozen. Ive repeated a few of them : gevent, asyncio, asyncio-uvloop and go for the echo server and these are the numbers roughly:

For gevent

$ ./echo_client
685393 0.98KiB messages in 30 seconds
Latency: min 0.04ms; max 4.48ms; mean 0.126ms; std: 0.048ms (37.68%)
Latency distribution: 25% under 0.088ms; 50% under 0.122ms; 75% under 0.158ms; 90% under 0.182ms; 99% under 0.242ms; 99.99% under 0.91ms