Skip to content

Instantly share code, notes, and snippets.

Zhihao Yuan lichray

Block or report user

Report or block lichray

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View libcudacxx_force_include.h
// This is how we run libc++ tests on the GPU without modification.
// We force include this header into each test with `-include`.
__host__ __device__
int fake_main(int, char**);
void fake_main_kernel(int * ret)
*ret = fake_main(0, NULL);
wengxt / introspect.c
Last active Apr 2, 2017
View introspect.c
/* Copyright (c) 2017-2017 Weng Xuetian
* Copyright (c) 2007-2014 Massachusetts Institute of Technology
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
janlay /
Last active Apr 16, 2019
Updates all Git repos in directory, defaults to Vim bundles.
# author:
echo "Working on $WORKDING_DIR"
for i in `find "$WORKDING_DIR" -mindepth 1 -maxdepth 1 -type d`; do
imneme / randutils.hpp
Last active Jan 17, 2020
Addresses common issues with C++11 random number generation; makes good seeding easier, and makes using RNGs easy while retaining all the power.
View randutils.hpp
* Random-Number Utilities (randutil)
* Addresses common issues with C++11 random number generation.
* Makes good seeding easier, and makes using RNGs easy while retaining
* all the power.
* The MIT License (MIT)
* Copyright (c) 2015 Melissa E. O'Neill
anonymous / gist:7700052
Created Nov 29, 2013
Fast C++ Integer To String Conversion
View gist:7700052
* The C++ Integer To String Conversion Benchmark *
* *
* Version: 2.718-20131130 *
* *
* This benchmark is based on the solutions provided in the following *
* stackoverflow question: *
* *
* (Date: 20101204) *
espeed / install-hyperdex-on-fedora-19.bash
Last active Dec 22, 2015
HOWTO Install HyperDex on Fedora 19 - The HyperDex packages in the HyperDex Fedora repo are for Fedora 17, and they don't work on Fedora 19. Here is what you need to do to build and install HyperDex on Fedora 19...
View install-hyperdex-on-fedora-19.bash
# How to Install HyperDex 1.0x on Fedora 19
# by James Thornton,
# First ensure you have these Fedora 19 packages installed
sudo yum install git autoconf automake autoconf-archive \
libtool python-devel pyparsing popt-devel \
cityhash-devel gcc-c++ glog-devel leveldb-devel \
bison gperf flex python-sphinx pandoc help2man
gintenlabo /
Created Aug 28, 2013
compose overloaded function in C++11
#include <type_traits>
#include <utility>
namespace etude {
template<class... Fs>
struct overloaded_function_impl_;
struct overloaded_function_impl_<> {
template<class... Args,
lichray /
Last active Apr 8, 2019
Factory function of std::array
#include <array>
#include <functional>
template <typename... T>
using common_type_t = typename std::common_type<T...>::type;
template <typename T>
using remove_cv_t = typename std::remove_cv<T>::type;
template <bool, typename T, typename... U>
jboner / latency.txt
Last active Jan 20, 2020
Latency Numbers Every Programmer Should Know
View latency.txt
Latency Comparison Numbers (~2012)
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
You can’t perform that action at this time.