Skip to content

Instantly share code, notes, and snippets.

View meritozh's full-sized avatar
:octocat:
5 plan, finish 0/5

gaowanqiu meritozh

:octocat:
5 plan, finish 0/5
View GitHub Profile
diff --git a/CallLogDrawer_LogIter.pm b/CallLogDrawer_LogIter.pm
index 5af3272..2de1d3d 100644
--- a/CallLogDrawer_LogIter.pm
+++ b/CallLogDrawer_LogIter.pm
@@ -19,7 +19,7 @@ sub new {
open($fh, "<", $infpath) or die "Failed to open $infpath: $!";
}
my ($ana_in, $ana_out);
- my $pid = open2($ana_out, $ana_in, "LANG=c addr2line -fps -e $bin");
+ my $pid = open2($ana_in, $ana_out, "LANG=c atos -o $bin");
@meritozh
meritozh / Image.tsx
Created January 11, 2019 11:51
strange type infer error
/*
* This component is built using `gatsby-image` to automatically serve optimized
* images with lazy loading and reduced file sizes. The image is loaded using a
* `StaticQuery`, which allows us to load the image from directly within this
* component, rather than having to pass the image data down from pages.
*
* For more information, see the docs:
* - `gatsby-image`: https://gatsby.app/gatsby-image
* - `StaticQuery`: https://gatsby.app/staticquery
*/
@meritozh
meritozh / profile.log
Last active October 3, 2017 11:39
vim profile for a strange slowness experience when use YCM with preview window
SCRIPT /usr/local/Cellar/macvim/8.0-137_2/MacVim.app/Contents/Resources/vim/runtime/syntax/cpp.vim
Sourced 1 time
Total time: 0.004365
Self time: 0.000759
count total (s) self (s)
" Vim syntax file
" Language: C++
" Current Maintainer: vim-jp (https://github.com/vim-jp/vim-cpp)
" Previous Maintainer: Ken Shan <ccshan@post.harvard.edu>
@meritozh
meritozh / template_even_odd.cpp
Created July 31, 2017 09:14
C++ template div integer to even and odd.
#include <iostream>
template <int I>
void div( char(*)[I % 2 == 0] = 0 ) {
std::cout << "even!!!" << std::endl;
}
template <int I>
void div( char(*)[I % 2 == 1] = 0 ) {
std::cout << "odd!!!" << std::endl;
@meritozh
meritozh / # macvim - 2017-07-19_23-31-23.txt
Created July 19, 2017 15:53
macvim on macOS 10.12.6 - Homebrew build logs
Homebrew build logs for macvim on macOS 10.12.6
Build date: 2017-07-19 23:31:23
@meritozh
meritozh / endian.c
Created October 20, 2016 14:47
little endian and big endian
#include <netinet/in.h>
#include <stdio.h>
int main(int argc, const char *argv[]) {
int i = 1093173256;
int k = htonl(i);
printf("%d %d\n", i, k);
return 0;
}
@meritozh
meritozh / isqrt.cpp
Created April 10, 2016 09:32 — forked from miloyip/isqrt.cpp
Big integer square root
#include <cassert>
#include <iostream>
#include <vector>
#include <type_traits>
// http://www.embedded.com/electronics-blogs/programmer-s-toolbox/4219659/Integer-Square-Roots
uint32_t isqrt0(uint32_t n) {
uint32_t delta = 3;
for (uint32_t square = 1; square <= n; square += delta)
@meritozh
meritozh / xhyve-freebsd-tutorial-1.md
Created April 9, 2016 12:36 — forked from tanb/xhyve-freebsd-tutorial-1.md
FreeBSD running on xhyve tutorial. (Appendix: Resize image with qemu. Create FreeBSD VM with qemu).

TL;DR

  • Create 5GB FreeBSD image.
  • Install FreeBSD on xhyve.
  • Mount host directory.

Requisites

@meritozh
meritozh / fstream_to_fstream.cpp
Created April 8, 2016 02:00
file stream to file stream
#include <fstream>
int main(int argc, char const *argv[])
{
std::ifstream input(argv[1], std::ios::binary);
std::ofstream output(argv[2], std::ios::binary);
output << input.rdbuf();
input.close();