This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env python | |
| from unicodedata import category | |
| PREFIX = u'\u003D\u035E\u035F\u035F\u035E' | |
| def do(istream, ostream): | |
| for c in istream.read(): | |
| if category(c) not in ['Cc', 'Zs']: | |
| ostream.write(PREFIX) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defun frame-alpha-offset (d) | |
| (let* ((a (frame-parameter nil 'alpha)) | |
| (b (+ d (if (integerp a) a 100))) | |
| (c (cond ((< b 20) 20) | |
| ((> b 100) 100) | |
| (t b)))) | |
| (set-frame-parameter nil 'alpha c))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function! transparency#Shift(ofs) | |
| let l:l = &g:transparency | |
| if type(l:l) != 0 | |
| let l:l = 0 | |
| endif | |
| let l:l += a:ofs | |
| if l:l < 0 | |
| let l:l = 0 | |
| endif | |
| if 80 < l:l |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| xs = ''' | |
| accounts.google.com | |
| google.co.jp | |
| mail.google.com | |
| www.google.co.jp | |
| www.youtube.com | |
| youtube.com | |
| '''.strip().split() | |
| sorted(xs, key=lambda v:'.'.join(reversed(v.split('.')))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defun escape-shell-arg (x) | |
| (concat "'" (replace-regexp-in-string "'" "'\\\\''" x) "'")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defun or/l (args) | |
| (let ((r nil)) | |
| (while (and args (null r)) | |
| (setq r (or r (car args))) | |
| (setq args (cdr args))) | |
| r)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| # http://www.checkio.org/mission/brackets/ | |
| # 普通こうでは!? | |
| from itertools import dropwhile | |
| pairs = '{} [] ()'.split() | |
| def parse_term(s): | |
| t = ''.join(dropwhile(str.isdigit, s)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from math import pi, sqrt, acos, asin | |
| def vsub(a, b): | |
| return (a[0] - b[0], a[1] - b[1]) | |
| def hit(a, b, c, p): | |
| ab = vsub(b, a) | |
| bp = vsub(p, b) | |
| bc = vsub(c, b) | |
| cp = vsub(p, c) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from math import pi, sqrt, acos, asin, sin, cos | |
| for n in range(0, 360+1, 10): | |
| x = cos(pi * n / 180) | |
| y = sin(pi * n / 180) | |
| r = sqrt(x ** 2 + y ** 2) | |
| th_cos = 180 * acos(x / r) / pi | |
| th_sin = asin(y / r) | |
| if th_sin < 0: | |
| th_cos = 360 - th_cos |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // g++ -std=c++11 RiverCrossing.cpp | |
| #include <iostream> | |
| #include <queue> | |
| #include <vector> | |
| #include <array> | |
| #include <algorithm> | |
| using namespace std; |