Skip to content

Instantly share code, notes, and snippets.

View Axure's full-sized avatar
😃
Time is money

Hu Zheng Axure

😃
Time is money
View GitHub Profile
@Axure
Axure / op.c
Last active October 27, 2016 15:14
#include <stdio.h>
#include <stdbool.h>
#include <ctype.h>
#define def_reg(n) int reg##n; scanf("%d", &reg##n)
#define print_reg(n) printf("%d ", reg##n);
#define case_assign(target, n) \
case n: \
target = reg##n; \
@Axure
Axure / CMakeLists.txt
Created July 30, 2016 18:16
Demo CLion Wrong Inspections.
set(CMAKE_AUTOMOC OFF)
set(CMAKE_CXX_STANDARD 14)
find_package(Qt5Widgets)
target_link_libraries(qt Qt5::Widgets)
add_executable(demo_error demo_error.cpp)
target_link_libraries(demo_error Qt5::Widgets)
@Axure
Axure / relay.d.ts
Created July 19, 2016 10:33 — forked from guncha/relay.d.ts
Very basic Relay typings for Typescript
declare module 'react-relay' {
// fragments are a hash of functions
interface Fragments {
[query: string]: ((variables?: RelayVariables) => string)
}
interface CreateContainerOpts {
initialVariables?: Object
prepareVariables?(prevVariables: RelayVariables): RelayVariables
@Axure
Axure / row_simple.jl
Last active June 2, 2016 05:13
Julia operations.
function swap_row!{T}(X::Array{T,2}, i, j)
if i != j
@inbounds for k in 1:size(X, 2)
X[i, k], X[j, k] = X[j, k], X[i, k]
end
end
return X
end
function swap_column!{T}(X::Array{T,2}, i, j)
@Axure
Axure / main.cpp
Created May 3, 2016 12:12
ForkJoinPool
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <thread>
#include <queue>
#include <sstream>
#define MAX 100
#define MAX_SMALL 10
@Axure
Axure / PagedFileBrowser.java
Created May 3, 2016 04:15
Paged File Browser
package edu.zju;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.*;
public class PagedFileBrowser extends JPanel
implements ActionListener {
@Axure
Axure / main.c
Last active April 25, 2016 18:07
plot_binary_tree
#include <glib.h>
#include <stdlib.h>
#include <assert.h>
#include <math.h>
#include <glib-object.h>
#define ax_deref(type, value) (*((type*)value))
/**
*
*/
@Axure
Axure / main.cpp
Last active December 19, 2017 11:42
C++ Meta Programming like Lisp
#include <iostream>
#include <sstream>
#include <utility>
#include <tuple>
#include <string>
#include <cstring>
#include <cassert>
#include <list>
#include <vector>
#include <deque>
@Axure
Axure / prime.cpp
Last active April 17, 2016 12:51
Something involved with prime numbers.
#include <iostream>
#include <thread>
#include <list>
#include <deque>
#include <tuple>
#include <cassert>
#include <sstream>
#include <unordered_map>
#define MAX 10
@Axure
Axure / FindSSE.cmake
Created January 5, 2016 07:05 — forked from hideo55/FindSSE.cmake
CMake module that detect SSE support
# Check if SSE instructions are available on the machine where
# the project is compiled.
MACRO (FindSSE)
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
EXEC_PROGRAM(cat ARGS "/proc/cpuinfo" OUTPUT_VARIABLE CPUINFO)
STRING(REGEX REPLACE "^.*(sse2).*$" "¥¥1" SSE_THERE ${CPUINFO})
STRING(COMPARE EQUAL "sse2" "${SSE_THERE}" SSE2_TRUE)