Skip to content

Instantly share code, notes, and snippets.

View h1994st's full-sized avatar
🧠
Focusing

Shengtuo Hu h1994st

🧠
Focusing
View GitHub Profile
@carter-yagemann
carter-yagemann / pt-check.c
Created November 21, 2019 21:36
Quick and dirty check for Intel Processor Trace (PT) features.
/*
* Copyright 2019 Carter Yagemann <yagemann@gatech.edu>
*
* 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:
*
@ryuta46
ryuta46 / ParameterizedTest.swift
Last active April 7, 2019 22:00
Swift 4 XCTest parameterized test template and sample.
import Foundation
import XCTest
// Parameterized Test Template
class ParameterizedTest : XCTestCase {
class func createTestCases() -> [ParameterizedTest] {
fatalError("""
You must override createTestCases() in following way.
override class func createTestCases() -> [ParameterizedTest] {
@ErikAugust
ErikAugust / spectre.c
Last active April 15, 2024 13:55
Spectre example code
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h> /* for rdtscp and clflush */
#pragma optimize("gt",on)
#else
#include <x86intrin.h> /* for rdtscp and clflush */
#endif
Michael Chow, David Meisner, Jason Flinn, Daniel Peek, Thomas F. Wenisch

What is the Problem? [Good papers generally solve a single problem]

Existing performance debugging methods for complex distributed systems do not provide useful information about end-to-end performance characteristics, because it is challenging to construct an execution model of requests in a highly-distributed heterogeneous system.

@algal
algal / PrintToStdErr.swift
Last active July 27, 2022 06:47
print to stderr in Swift 3
// known-good: Xcode 8, Swift 3
import Foundation
var standardError = FileHandle.standardError
extension FileHandle : TextOutputStream {
public func write(_ string: String) {
guard let data = string.data(using: .utf8) else { return }
@CMCDragonkai
CMCDragonkai / memory_layout.md
Last active April 28, 2024 18:50
Linux: Understanding the Memory Layout of Linux Executables

Understanding the Memory Layout of Linux Executables

Required tools for playing around with memory:

  • hexdump
  • objdump
  • readelf
  • xxd
  • gcore
@narutaro
narutaro / Nerdtree in docker container.md
Last active February 14, 2019 01:17
Nerdtree in docker container

Nerdtree in docker container

Symptom

  • In the tree view of nerdtree, you see ?~V? instead of arrow shape.

Possible reason

  1. vim is not installed but vi
  2. The locale setting is wrong

Solutions

@zealic
zealic / Email
Last active April 21, 2024 20:32
class Object {
begin 777 portal.bin
M(R!796QC;VUE#0H-"B,C($ME>0T*#0I24T$@4'5B;&EC($ME>3H@*$XL(#<I
M#0I.(#T@,C,S("H@30T*32!I<R!T:&4@9W)E871E<W0@9F]U<BUD:6=I="!P
M<FEM92!T:&%T(&UA:V5S($X@96YD('=I=&@@,C,S#0H-"B,C($5N8W)Y<'1E
M9"!!=61I="!142!G<F]U<"!N=6UB97(-"@T*5&AE($%U9&ET(%%1(&=R;W5P
M(&YU;6)E<B!I<R!E;F-R>7!T960@=VET:"!T:&4@*BI24T$@4'5B;&EC($ME
M>2HJ+@T*#0I@8&`-"D-/3D-!5"A$14-265!4*#$Y-S,W,BDN=&]3=')I;F<H
M*2P@1$5#4EE05"@S,S,P-SDI+G1O4W1R:6YG*"DI#0I@8&`-"@T*(R!#05!4
M0TA!#0I5<V4@=&AI<R!G:7-T(')E=FES:6]N(&`W9#(S939E.3DY-&)B-F9A
M93@W-&1A8C,U930V9F0W-6(Y9&0Q-6)E8"!R97-U;'0@87,@0T%05$-(02X-
@sdjacobs
sdjacobs / cities.tsv
Last active March 2, 2019 02:14
Dijkstra's algorithm in Javascript/D3
We can make this file beautiful and searchable if this error is corrected: It looks like row 7 should actually have 29 columns, instead of 13. in line 6.
Cities1 Birmingham Boston Buffalo Chicago Cleveland Dallas Denver Detroit El Paso Houston Indianapolis Kansas City Los Angeles Louisville Memphis Miami Minneapolis New Orleans New York Omaha Philadelphia Phoenix Pittsburgh St. Louis Salt Lake City San Francisco Seattle Washington
Birmingham, Ala. — 1194 947 657 734 653 1318 754 1278 692 492 703 2078 378 249 777 1067 347 983 907 894 1680 792 508 1805 2385 2612 751
Boston, Mass. 1194 — 457 983 639 1815 1991 702 2358 1886 940 1427 3036 996 1345 1539 1402 1541 213 1458 304 2664 597 1179 2425 3179 3043 440
Buffalo, N.Y. 947 457 — 536 192 1387 1561 252 1928 1532 510 997 2606 571 965 1445 955 1294 436 1011 383 2234 219 749 1978 2732 2596 386
Chicago, Ill. 657 983 536 — 344 931 1050 279 1439 1092 189 503 2112 305 546 1390 411 947 840 493 758 1729 457 293 1458 2212 2052 695
Cleveland, Ohio 734 639 192 344 — 1205 1369 175 1746 1358 318 815 2424 379 773 1325 763 1102 514 819 432 2052 131 567 1786 2540 2404 369
Dallas, Tex. 653 1815 1387 931 1205 — 801 1167 625 242 877 5
@subfuzion
subfuzion / global-gitignore.md
Last active April 23, 2024 22:47
Global gitignore

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.

All other files should be in your own global gitignore file:

  • Create a file called .gitignore in your home directory and add any filepath patterns you want to ignore.
  • Tell git where your global gitignore file is.

Note: The specific name and path you choose aren't important as long as you configure git to find it, as shown below. You could substitute .config/git/ignore for .gitignore in your home directory, if you prefer.