Skip to content

Instantly share code, notes, and snippets.

mecab mecab

Block or report user

Report or block mecab

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mecab
mecab / wpb.sh
Last active Jan 16, 2017 — forked from greymd/wpb.sh
copy & paste through Web
View wpb.sh
# Usage
## Example 1 (Text)
# $ echo foobar | wpbcopy
# $ wpbpaste
# foobar
## Example 2 (Binary)
# $ cat image.jpg| wpbcopy
# $ wpbpaste | file -
@mecab
mecab / color.sh
Last active Dec 15, 2016
hashed_color(), which outputs sets unique background for given string and eye-friendly foregrand (white or black).
View color.sh
#!/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]
#
View kiyoshi-rxjs.js
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); })
@mecab
mecab / gist:7740345
Last active Dec 29, 2015
RxJS and Socket.io
View gist:7740345
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() {
// ...
});
View custom_json_encoder.py
from django.utils import simplejson as json
class SerializeMethod(object):
def __init__(self):
self.type = type_
self.func = func
class CustomJSONEncoder(json.JSONEncoder):
View fft.py
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
View dft.py
import cmath
I = 1j
data = [ cmath.sin(cmath.pi * 2 * x / 16.0) + 1 for x in xrange(16)]
def dft_gen(data):
return (_sum_xk(data, j) for j in xrange(len(data)))
View my-window-resizer.l
(defun my-window-resizer ()
"Control window size and position."
(interactive)
(let ((window-obj (selected-window))
(current-width (window-width))
(current-height (window-height))
(dx (if (= (nth 0 (window-coordinate)) 0) 1
-1))
(dy (if (= (nth 1 (window-coordinate)) 0) 1
-1))
@mecab
mecab / myitertools.py
Last active Dec 11, 2015
A custom iterators for me :D
View myitertools.py
import itertools
import math
def defer(l, num_defer=1):
"""
>>> [x for x in defer([0, 1, 2, 3])]
[[0, 1], [1, 2], [2, 3]]
>>> [x for x in defer([0, 1, 2, 3], 2)]
[[0, 2], [1, 3]]
@mecab
mecab / mactype.ini
Created Nov 19, 2012
My MacType configuration.
View mactype.ini
[General]
HintingMode=2
AntiAliasMode=1
NormalWeight=8
BoldWeight=0
ItalicSlant=0
EnableKerning=1
GammaMode=0
LcdFilter=1
BolderMode=0
You can’t perform that action at this time.