Skip to content

Instantly share code, notes, and snippets.

View east825's full-sized avatar

Mikhail Golubev east825

View GitHub Profile
@east825
east825 / main-child.c
Created September 18, 2012 18:13
Наследование дескриптора
#include <windows.h>
#include <stdio.h>
// сообщение для записи в файл
#define MESSAGE "child process message"
int main(int argc, char *argv[])
{
printf("in child process\n");
if (argc != 2) {
@east825
east825 / cut_commentaries.py
Created September 20, 2012 15:31
function to remove multiline commentaries from C code
import re
strings_literals = re.compile(r'"(?:\\"|.)*?"')
commentaries = re.compile(r'/\*.*?\*/', re.DOTALL)
placeholder = '<{}>'
def cut_commentaries(s):
strings = []
def insert_placeholder(m):
print(m.group(0))
package generics.minfunction;
import java.util.ArrayList;
import java.util.List;
public class Test {
private static class Top {}
private static class Middle extends Top implements Comparable<Top> {
@Override
public int compareTo(Top o) {
@east825
east825 / complex_numpy_docstring.py
Created October 13, 2015 12:22
Numpy docstring with arcane formatting
def cond(x, p=None):
"""
Compute the condition number of a matrix.
This function is capable of returning the condition number using
one of seven different norms, depending on the value of `p` (see
Parameters below).
Parameters
from collections import defaultdict, OrderedDict
from typing import Dict, overload, TypeVar
T = TypeVar('T')
@overload
def func(foo: T, bar) -> Dict[T, int]:
return defaultdict(int)
import os, sys
from typing import Text, Union
def to_text(s: Union[bytes, Text]) -> Text:
if isinstance(s, bytes):
return s.decode(encoding=os.getenv('ENCODING', sys.stdin.encoding))
return s
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,