Skip to content

Instantly share code, notes, and snippets.

@liyang85105
liyang85105 / list.h
Created March 16, 2021 06:41 — forked from jiunbae/list.h
Lock Free Linked List
/*****************************************************************************
MIT License
Copyright (c) 2017 Bae jiun, Maybe
@see also https://choosealicense.com/licenses/mit/
*****************************************************************************/
@liyang85105
liyang85105 / network.py
Created September 22, 2018 09:23
Decorator for composable network layers
import numpy as np
import tensorflow as tf
DEFAULT_PADDING = 'SAME'
def layer(op):
'''Decorator for composable network layers.'''
def layer_decorated(self, *args, **kwargs):
@liyang85105
liyang85105 / print_macro.cc
Created August 15, 2017 03:14
print macro(#define macro ...)'s value when using gcc/g++
/* Some test definition here */
#define DEFINED_BUT_NO_VALUE
#define DEFINED_INT 3
#define DEFINED_STR "ABC"
/* definition to expand macro then apply to pragma message */
#define VALUE_TO_STRING(x) #x
#define VALUE(x) VALUE_TO_STRING(x)
#define VAR_NAME_VALUE(var) #var "=" VALUE(var)
@liyang85105
liyang85105 / no_main.c
Last active August 14, 2017 05:59
specify entry point of a c/c++ program instead of main
#include <stdio.h>
#include <stdlib.h>
/*extern "C"*/ int sum(int a, int b)
{
return 2 * a + 3 * b;
}
/*extern "C"*/ int entry()
{
#include <stdio.h>
#include <string.h>
void copy(char * to, char * from, int count)
{
int n = (count + 7 ) / 8 ;
switch (count % 8 ) {
case 0 : do { *to++ = *from++;
case 7 : *to++ = *from++;
case 6 : *to++ = *from++;
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#define CUTOFF 8
/**
* sort elements in range array[begin, ..., end],
* both edge are closed.
*/
#include <stdio.h>
#include <string.h>
// define the alpha table size
#define ASIZE 128
static int jump_table[ASIZE];
void preprocess(char * pattern, int m)
{
#include <iostream>
#include <vector>
// rank based union, with path compressed
class UnionFindSet
{
public:
UnionFindSet(const int N);
void Union(int p, int q);