Skip to content

Instantly share code, notes, and snippets.

async def create_piped_processes(
*cmds, stdin = asyncio.subprocess.DEVNULL, stdout = None):
if stdout is None:
out, w = os.pipe()
else:
out = None
w = stdout
p = []
for ii, c in reversed(tuple(enumerate(cmds))):
if ii == 0:
const s = '#6c757d';
console.log(s.replace(/#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])/i,
(m, r, g, b) => `rbd(${parseInt(r, 16)}, ${parseInt(g, 16)}, ${parseInt(b, 16)})`));
console.log(s.replace(/#([0-9a-f]{6})/i, (m, rgb) => (h => `rbg(${h >> 16}, ${(h >> 8) & 255}, ${h & 255})`)(parseInt(rgb, 16))));
console.log(s.replace(/#[0-9a-f]{6}/i, xrgb => (h => `rbg(${h >> 16}, ${(h >> 8) & 255}, ${h & 255})`)(parseInt(xrgb.substring(1), 16))));
@h2oota
h2oota / mpd_select_playlist.sh
Created December 25, 2016 10:19
mpdのプレイリストを再生します。 irexecから実行するために作りました。
#!/bin/sh
case $1 in
!!!\ locked\ !!!)
shift
;;
*)
case $1 in
[-+] | forward | backward | [1-9] | [1-9][0-9])
;;
*)
@h2oota
h2oota / shell.c.diff
Created May 18, 2013 03:46
a patch for output utf-8 strings in windows console.
--- shell.c.orig Fri Apr 12 21:21:39 2013
+++ shell.c Sat May 18 10:16:01 2013
@@ -36,6 +36,81 @@
#include <ctype.h>
#include <stdarg.h>
+#if defined(_WIN32)
+#include <windows.h>
+#include <wincon.h>
+static int stdout_is_interactive = 0;
@h2oota
h2oota / cli-mode.el
Last active December 16, 2015 19:38
cli-mode.el -- Microsoft C++/CLI mode
;; cli-mode.el -- Microsoft C++/CLI mode
;;
;; This mode is derived from C++ mode.
;;
(require 'cc-mode)
(eval-when-compile
(require 'cc-langs)
(require 'cc-fonts))
@h2oota
h2oota / Evaluator.cpp
Last active December 16, 2015 19:30
c++/cliからJScriptを呼び出します。 http://www.west-wind.com/WebLog/posts/10688.aspx (消滅)のコメント(by Lea Hayes October 01, 2008 @ 9:32 am)と 参照されているページ(http://odetocode.com/articles/80.aspx)を参考にしました。
ref class Evaluator
{
public:
static System::Object^ Eval(System::String ^statement) {
return _evaluatorType->InvokeMember(
"Eval",
System::Reflection::BindingFlags::InvokeMethod,
nullptr, _evaluator,
gcnew array<System::Object^>(1) { statement });
}
@h2oota
h2oota / REMEAD.md
Last active December 15, 2015 22:09
solarized configuration file generator for PuTTY
@h2oota
h2oota / msvcc.sh
Created February 18, 2013 04:37
# GCC-compatible wrapper for cl.exe and ml.exe. Arguments are given in GCC # format and translated into something sensible for cl or ml.
#!/bin/sh
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
@h2oota
h2oota / OpenDylan-FreeBSD-amd64-README.txt
Last active December 11, 2015 02:59
Building OpenDylan on FreeBSD-amd64
Building OpenDylan on FreeBSD amd64
===================================
Install tools
-------------
devel/autoconf, devel/gmake
Install Boehm-GC
----------------
+ put the patch into ports/devel/boehm-gc-threaded/files/patch-~~~__dyn_load.c
+ install ports
@h2oota
h2oota / openssl-1.0.0j.diff
Created January 3, 2013 12:43
s_client(OpenSSL)をWindows版Emacsの非同期プロセスから利用するためのパッチ。 s_clientは標準入出力がコンソールでないと動作しませんが、このパッチを適用する事で標準入出力がパイプの場合にも動作するようになります。
--- ./apps/app_rand.c.orig 2001-02-20 17:13:19.000000000 +0900
+++ ./apps/app_rand.c 2013-01-03 12:55:09.000000000 +0900
@@ -129,6 +129,7 @@ int app_RAND_load_file(const char *file,
BIO_flush(bio_e);
RAND_screen();
BIO_printf(bio_e," done\n");
+ BIO_flush(bio_e);
#endif
if (file == NULL)