Skip to content

Instantly share code, notes, and snippets.

@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 / REMEAD.md
Last active December 15, 2015 22:09
solarized configuration file generator for PuTTY
@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 / 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 / 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 / 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])
;;
*)
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))));
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: