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
@wilzbach
wilzbach / main.d
Last active Jul 24, 2018
C++ Munich Meetup - D without a runtime
View main.d
int foo(int a, int b)
{
return (a % 3235272) % b;
}
int bar(int a)
{
return foo(a, 88);
}
@nadavrot
nadavrot / Matrix.md
Last active Apr 1, 2020
Efficient matrix multiplication
View Matrix.md

High-Performance Matrix Multiplication

This is a short post that explains how to write a high-performance matrix multiplication program on modern processors. In this tutorial I will use a single core of the Skylake-client CPU with AVX2, but the principles in this post also apply to other processors with different instruction sets (such as AVX512).

Intro

Matrix multiplication is a mathematical operation that defines the product of

@xplorld
xplorld / leetcode 套路.md
Last active Sep 21, 2018
leetcode 套路
View leetcode 套路.md

array -> contiguous subarray with max(f(arr))

套路 - 2 max

从左往右扫,维护 2 个 max,

  • 一个是 max(sub(arr[0:n]))
  • 一个是 max(sub(arr[0:n], including arr[n]))
for n in arr:
@francisfeng
francisfeng / things-you-should-ask-hr.md
Last active Jan 20, 2020
Things You Should Ask HR
View things-you-should-ask-hr.md

Things You Should Ask HR

说明

为了尽量避免入职后才发现公司有不合意的地方,我根据经验,写下此 gist,包含「必问问题」、「工作相关」、「生活相关」三个列表。

「必问问题」是为保障求职者的自身权益而制定,你应该知道这个列表的所有答案。

「工作相关」是为了帮助求职者了解未来的工作内容而定,这里的问题你可挑选感兴趣的来问。

「生活相关」和「工作相关」类似,主要是为了方便入职后的生活,这里的问题可挑选提问。

View Traffic analysis survey.md

为什么流量可以进行分类

这里的“流量”一般定义为中间人观测到的一组由(时间,方向,包大小)元数据组成的序列 [Cai2014]。其源头是应用层的读写操作,经过传输层协议的变换(分片、协议状态机、加密等),流量序列产生一定变化。但是这种变化非常有限,因为流量的发生过程本质是确定性的,随机因素较小,因此对于特定环境中的特定应用(浏览器访问 google.com)各种流量特征体现出相当大的一致性和独特性,这就使“从流量特征识别应用”的监督学习问题成为可能。虽然有若干不利因素使得确定性下降,例如多层次上软件多版本的排列组合爆炸、有状态的缓存、流水线和连接复用、用户随机行为,但是因为版本的幂律分布、应用层读写操作间的依赖关系、流量特征和检测算法的改进等原因,分类依然具有相当的可行性。

分类的对象:流量应用分类与网站指纹攻击

根据分类的对象产生了两个相近但是不同的研究领域。从流量特征中分类应用类型的被称为流量分类(traffic classification),从流量特征中分类所访问网站或者网页的被称为网站指纹(website fingerprinting)。以机器学习的方法而论前者是比后者更弱但本质相同的一个问题。

这两类攻击的威胁类型不同。流量分类威胁的是可用性,如果GFW检出流量是隧道应用然后进行封锁,则破坏了可用性。而网站指纹威胁的是匿名性和隐私,如果从隐秘流量中检出是谁在访问哪个网站,则破坏了匿名性,丝绸之路就是这样被FBI破获的。

@qfgaohao
qfgaohao / device_properties.cu
Last active Oct 15, 2019
List GPU Specs. The code is modified from the Udacity Parallel Computing Course.
View device_properties.cu
#include <stdio.h>
void deviceQuery ()
{
cudaDeviceProp prop;
int nDevices=0, i;
cudaError_t ierr;
ierr = cudaGetDeviceCount(&nDevices);
@owulveryck
owulveryck / AAaa note.md
Last active Feb 21, 2020
havre / a docker like that runs an embedded squashfs image
View AAaa note.md

About

This is a proof of concept of a portable operating system a-la-docker.

It is a single binary that contains an image of an OS in SquashFS and the binary to run it.

a make will build the binary with an embedded alpine image. make havre-xenial will build a binary with an embedded ubuntu image.

What does the binary do?

@htfy96
htfy96 / static_inline_example.md
Last active Mar 21, 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; }
@antirez
antirez / lmdb.tcl
Created Apr 28, 2017
LMDB -- First version of Redis written in Tcl
View lmdb.tcl
# LVDB - LLOOGG Memory DB
# Copyriht (C) 2009 Salvatore Sanfilippo <antirez@gmail.com>
# All Rights Reserved
# TODO
# - cron with cleanup of timedout clients, automatic dump
# - the dump should use array startsearch to write it line by line
# and may just use gets to read element by element and load the whole state.
# - 'help','stopserver','saveandstopserver','save','load','reset','keys' commands.
# - ttl with milliseconds resolution 'ttl a 1000'. Check ttl in dump!
View set_qdisc.sh
#!/bin/bash -ue
# Sets up mq+$shed combo for given interface.
if [ $# -ne 2 ] || [ -z "$1" ] || [ -z "$2" ]; then
echo "usage: $0 interface scheduler" >&2
echo " e.g: $0 eth0 fq" >&2
echo " e.g: $0 eth0 pfifo_fast" >&2
exit 64 # EX_USAGE
fi
You can’t perform that action at this time.