Skip to content

Instantly share code, notes, and snippets.

@mecab
mecab / stratum.patch
Last active November 22, 2017 09:49 — forked from bitzeny/stratum.patch
diff --git a/externals/stratum b/externals/stratum
--- a/externals/stratum
+++ b/externals/stratum
@@ -1 +1 @@
-Subproject commit 8ba1b5fd8a802b981f31dace4cf920cfb4a3907c
+Subproject commit 8ba1b5fd8a802b981f31dace4cf920cfb4a3907c-dirty
diff --git a/lib/halfnode.py b/lib/halfnode.py
index 4ffc017..aca8cc8 100644
--- a/lib/halfnode.py
+++ b/lib/halfnode.py
@mecab
mecab / osc52e.el
Last active December 20, 2023 14:10 — forked from AlexCharlton/osc52e.el
Copy text from emacs into xterm, hterm, trough screen and tmux, with support for graphical displays and multi-byte characters
;;;; This script can be loaded during emacs initialization to automatically
;;;; send `kill-region' and `kill-ring-save' regions to your system clipboard.
;;;; The OSC 52 terminal escape sequence is used to transfer the selection from
;;;; emacs to the host terminal.
;;;; It is based off of the osc52.el copyright the Chromium OS authors, but
;;;; was modified to add support for tmux, graphical displays, and
;;;; multi-byte strings.
;;;; It works in hterm, xterm, and other terminal emulators which support the
@mecab
mecab / wpb.sh
Last active January 16, 2017 09:41 — forked from greymd/wpb.sh
copy & paste through Web
# Usage
## Example 1 (Text)
# $ echo foobar | wpbcopy
# $ wpbpaste
# foobar
## Example 2 (Binary)
# $ cat image.jpg| wpbcopy
# $ wpbpaste | file -
@mecab
mecab / send-region-to-clipboard.el
Last active July 22, 2017 17:16
Send region to the clipboard via the xterm clipboard integration (PASTE64/OSC52)
(defun send-region-to-clipboard (START END)
;; Place https://github.com/skaji/remote-pbcopy-iterm2/blob/master/pbcopy as `cpbcopy`
(interactive "r")
(let ((infile (make-temp-file "send-region-to-clipboard")))
(write-region (buffer-substring (region-beginning) (region-end))
nil
infile
nil
'nomsg)
(with-temp-buffer
@mecab
mecab / color.sh
Last active December 15, 2016 02:54
hashed_color(), which outputs sets unique background for given string and eye-friendly foregrand (white or black).
#!/bin/bash
color256()
{
# Output the color code from given RGB value.
# If the sole argument given, return it directly.
# One arg usage:
# - $1: color code [0-255]
#
var Rx = require('rx');
var Observable = Rx.Observable;
var match = ["ズン", "ズン", "ズン", "ズン", "ドコ"];
Observable.create((obs) => {
obs.onNext(Math.random() > 0.5 ? "ズン" : "ドコ");
obs.onCompleted();
})
.do((e) => { console.log(e); })
<link href="../google-map/google-map.html" rel="import">
<polymer-element name="my-element">
<template>
<style>
#design_host {
position: absolute;
width: 100%;
height: 100%;
@mecab
mecab / gist:7740345
Last active December 29, 2015 22:59
RxJS and Socket.io
var emit = Rx.Observable
.fromNodeCallback(that.socket.emit,
null,
that.socket); // Socket.io needs the socket as the context to handle ack.
emit.subscribe(function() {
// ...
});
from django.utils import simplejson as json
class SerializeMethod(object):
def __init__(self):
self.type = type_
self.func = func
class CustomJSONEncoder(json.JSONEncoder):
import cmath
def fft(data):
data = data[:] # copy data to avoid side effect
N = len(data)
w = calc_coefficients(N)
reorder_data(data)
a = 1