This file contains 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
#include <stdio.h> | |
/* bit logic experiment */ | |
int main(int argc, char *argv[]) | |
{ | |
int x, y = 0; | |
char input = '\0'; | |
printf("Enter first digit: "); |
This file contains 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
#actually do the grep | |
#well, actually use the native python functions, not grep... | |
def doGrep(self, word, directory): | |
out = () | |
for r,d,f in os.walk(directory): | |
#don't bother to look in git dirs | |
if ".git" not in r: | |
for files in f: |
This file contains 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
def _mark_pages(self, text): | |
""" | |
Inserts comments in %text to mark the end of pages. Differs from BDH's | |
in that it breaks only at newlines or punctuation for a clean result. | |
""" | |
# Regex ripped wholesale from BDH. | |
to_skip = re.compile(ur"""((-------------------------------------------------------.*?-------------------------------------------------------)|(|)|([#.*?])|(《.*?》)|(<.*?>)|(\n)|(\s))+""", re.UNICODE | re.S) | |
skipped = [] | |
for match in to_skip.finditer(text): |
This file contains 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 -*- | |
import re | |
""" Rubylizer | |
Module for preparing rubytext tags from the furigana marked in | |
青空文庫-formatted text. | |
""" |
This file contains 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
def contains(self, value): | |
""" contains | |
Searchs recursively for a node containing the given value from current | |
node. Returns True on success and False on failure. | |
Args: | |
value: the value being searched for in the tree. | |
""" | |
def _contains(value, current): |
This file contains 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 -*- | |
import ast | |
RE_EXPR = re.compile(ur"\((\d+\.?\d*\s?[+-]\s?\d+\.?\d*)\)") | |
RE_TIME = re.compile(ur"(\d{2}):(\d{2}):(\d{2})") | |
def parse_value(string, entry_type): | |
"""Parses an input value to floating point. Allows expressions | |
of the form `(XX.X[+-]XX.X)` or `XX:XX:XX` as special cases, otherwise |
This file contains 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
def get_entry_type(self): | |
"""Returns selected entry type as string key.""" | |
radio_pairs = [(self.window.ui.book_radio, 'book'), | |
(self.window.ui.manga_radio, 'manga'), | |
(self.window.ui.game_radio, 'game'), | |
(self.window.ui.flgame_radio, 'fullgame'), | |
(self.window.ui.net_radio, 'net'), | |
(self.window.ui.news_radio, 'news'), | |
(self.window.ui.nico_radio, 'nico'), | |
(self.window.ui.subs_radio, 'subs'), |
This file contains 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
// 4241 4-bit Microprocessor | |
// | |
// Registers: r0 r1 | |
// | |
// 1-byte Instructions | |
// 0 = Halt | |
// 1 = Add (r0 = r0 + r1) | |
// 2 = Subtract (r0 = r0 - r1) | |
// 3 = Increment r0 | |
// 4 = Increment r1 |
This file contains 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 -*- | |
FULL_KATA_OFFSET = ord(u"ァ") - ord(u"ぁ") | |
half_kata_to_hira = u"をぁぃぅぇぉゃゅょっーあいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよ" | |
def normalize_kana(s): | |
"""Normalizes all kana in the given string to full-width hiragana. | |
Args: | |
s String to be normalized. |
This file contains 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
#include <stdint.h> | |
#include <stdbool.h> | |
typedef unsigned char uchar8_t; | |
static bool is_leading_byte(const uchar8_t c) | |
{ | |
return (c <= 0x7f || c >= 0xc2); | |
} |
OlderNewer