Skip to content

Instantly share code, notes, and snippets.

Zheng Luo htfy96

Block or report user

Report or block htfy96

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
@htfy96
htfy96 / strong-datas.md
Last active Jun 2, 2018
839-strong-datas
View strong-datas.md

2000 strings, all 'aaaaaaaaa'

["aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaa
@htfy96
htfy96 / bookmarklet.md
Last active May 15, 2018
Simple bookmarklet to send current webpage to dyweb/weekly
View bookmarklet.md

Add the following target to your bookmark bar.

Remember to replace %24YOUR_TOKEN_HERE with your Github personal access token. The token could be acquired at Settings -> Developer Settings -> Personal Access Token and check public_repo permission.

javascript:(function()%7Bconst%20apiRequest%20%3D%20(src%2C%20param)%20%3D%3E%20fetch('https%3A%2F%2Fapi.github.com%2F'%20%2B%20src%2C%20Object.assign(%7Bheaders%3A%20%7B%20Accept%3A%20'application%2Fvnd.github.v3%2Bjson'%2C%20'Content-Type'%3A%20'application%2Fjson'%2C%20Authorization%3A%20'token%20%24YOUR_TOKEN_HERE'%20%7D%7D%2C%20param))%3BapiRequest('repos%2Fdyweb%2Fweekly%2Fissues').then(v%20%3D%3E%20v.json()).then(d%20%3D%3E%20d.filter(item%20%3D%3E%20item.labels.some(lab%20%3D%3E%20lab.name%20%3D%3D%3D%20'working'))%5B0%5D.number).then(issuenum%20%3D%3E%20%7Bconst%20url%20%3D%20'repos%2Fdyweb%2Fweekly%2Fissues%2F'%20%2B%20issuenum%20%2B%20'%2Fcomments'%3Bconst%20description%20%3D%20window.prompt('Please%20input%20your%20description%20of%20this%2
@htfy96
htfy96 / bad_rendering_results.md
Last active Dec 27, 2017
A collection of my bad rendering results
@htfy96
htfy96 / osuperfast.md
Last active Dec 11, 2017
-Osuperfast: gcc optimization flags used in our project
View osuperfast.md
CXXFLAGS="-ffast-math -fdevirtualize-speculatively  -fassociative-math -freciprocal-math -fno-signed-zeros -fno-trapping-math -fipa-pta -mrecip=all -fgcse-sm -fgcse-las -fgcse-after-reload -march=native  -ftree-vectorize -floop-interchange -floop-block -ftree-coalesce-vars -floop-nest-optimize -fgraphite-identity -ftree-loop-ivcanon -fivopts" LDFLAGS="-ffast-math -fdevirtualize-speculatively"

Benchmark

Basic O3 + -march=native

rendering time = 91ms

Basic O3 + -march=native + -ffast-math + -mrecip=all

rendering time = 92ms

@htfy96
htfy96 / gdb_cquery.log
Created Nov 19, 2017
GDB log for cquery
View gdb_cquery.log
(gdb) info threads
Id Target Id Frame
* 1 Thread 0x7f7c5e0c3740 (LWP 11427) "querydb" 0x00007f7c5a696756 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
2 Thread 0x7f7c5936a700 (LWP 11428) "stdin" 0x00007f7c598caa98 in read () from /usr/lib/libc.so.6
3 Thread 0x7f7c58b69700 (LWP 11429) "stdout" 0x00007f7c5a696756 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
4 Thread 0x7f7c48368700 (LWP 11430) "completequery" 0x00007f7c5a69143d in pthread_join () from /usr/lib/libpthread.so.0
5 Thread 0x7f7c53fff700 (LWP 11431) "completeparse" 0x00007f7c5a69143d in pthread_join () from /usr/lib/libpthread.so.0
6 Thread 0x7f7c537fe700 (LWP 11432) "indexer0" 0x00007f7c5a696756 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
7 Thread 0x7f7c52ffd700 (LWP 11433) "indexer1" 0x00007f7c5a696756 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
8 Thread 0x7f7c527fc700 (LWP 11434) "indexer2
View _GLIBCXX_CONCEPT_CHECKS.md

Introduction

_GLIBCXX_CONCEPT_CHECKS, according to online doc of gcc, is a macro that performs compile-time checking on certain template instantiations to detect violations of the requirements of the standard. This macro has no effect for freestanding implementations.

Example

#include <set>

struct A
{
@htfy96
htfy96 / gnome-shell.css
Created Oct 8, 2017
gnome-shell adapta theme css
View gnome-shell.css
/* This file is part of adapta-gtk-theme Copyright (C) 2016-2017 Tista <tista.gma500@gmail.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. */
* { transition-property: border-color, border-image, background-color, background-image, box-shadow; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 0.15s; }
*:focus { transition-duration: 0s; }
stage { font-size: 10pt; font-family: Roboto, Cantarell, Sans-Serif; font-weight: 400; color: #263238; }
.button { border-color: transparent; color: rgba(38, 50, 56, 0.87); background-color: transparent; box-shadow: 0 0 transparent; text-shadow: none; icon-shadow: none; padding: 7px 16px 8px; border-radius: 2px; border-width: 0; font-weight: 500; }
.button:hover { border-color: transparent; color: #263238; background-color: rgba(38, 50, 56, 0.12); box
@htfy96
htfy96 / static_inline_example.md
Last active Jan 17, 2020
static inline vs inline vs static in C++
View static_inline_example.md

In this article we compared different behavior of static, inline and static inline free functions in compiled binary. All the following test was done under g++ 7.1.1 on Linux amd64, ELF64.

Test sources

header.hpp

#pragma once

inline int only_inline() { return 42; }
static int only_static() { return 42; }
View init.vim
set shell=/bin/bash
syntax on
if &term =~ '^\(xterm\|screen\)$' && $COLORTERM == 'gnome-terminal'
set t_Co=256
endif
filetype on
filetype plugin on
set autoindent
set nolazyredraw
set number
View call_n_times.cpp
#include <iostream>
#include <array>
#include <cassert>
using namespace std;
constexpr int f()
{
return 42;
}
You can’t perform that action at this time.