Skip to content

Instantly share code, notes, and snippets.

@yaowenqiang
yaowenqiang / settings.jsonc
Created May 15, 2023 13:26 — forked from hyperupcall/settings.jsonc
VSCode config to disable popular extensions' annoyances (telemetry, notifications, welcome pages, etc.)
View settings.jsonc
// I'm tired of extensions that automatically:
// - show welcome pages / walkthroughs
// - show release notes
// - send telemetry
// - recommend things
//
// This disables all of that stuff.
// If you have more config, leave a comment so I can add it!!
{
View macOS Internals.md

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

View gist:912ca5d9460bf202521c3aeac1748d1b

Cryptographic Best Practices

Putting cryptographic primitives together is a lot like putting a jigsaw puzzle together, where all the pieces are cut exactly the same way, but there is only one correct solution. Thankfully, there are some projects out there that are working hard to make sure developers are getting it right.

The following advice comes from years of research from leading security researchers, developers, and cryptographers. This Gist was [forked from Thomas Ptacek's Gist][1] to be more readable. Additions have been added from

@yaowenqiang
yaowenqiang / Regex to search only in NCLOCs
Created February 16, 2023 03:10 — forked from trebron21/Regex to search only in NCLOCs
Regex to search only between uncommented lines (NCLOC - Non-Comment Lines Of Code)
View Regex to search only in NCLOCs
Search only between uncommented lines (NCLOC - Non-Comment Lines Of Code):
First solution matches "keyWord" which is not commented with single line comment //
^*(?<!\/\/.*)keyWord // this uses negative lookbehind
or another solution without lookbehind for regex engines, that does not support it:
^[^//]*keyWord
@yaowenqiang
yaowenqiang / sniff.txt
Created January 12, 2023 09:51 — forked from manifestinteractive/sniff.txt
A friendly formatter for curl requests to help with debugging.
View sniff.txt
\n
============= HOST: ==========\n
\n
local_ip: %{local_ip}\n
local_port: %{local_port}\n
remote_ip: %{remote_ip}\n
remote_port: %{remote_port}\n
\n
======= CONNECTION: ==========\n
\n
@yaowenqiang
yaowenqiang / Quirks of C.md
Created November 21, 2022 10:30 — forked from fay59/Quirks of C.md
Quirks of C
View Quirks of C.md

Here's a list of mildly interesting things about the C language that I learned mostly by consuming Clang's ASTs. Although surprises are getting sparser, I might continue to update this document over time.

There are many more mildly interesting features of C++, but the language is literally known for being weird, whereas C is usually considered smaller and simpler, so this is (almost) only about C.

1. Combined type and variable/field declaration, inside a struct scope [https://godbolt.org/g/Rh94Go]

struct foo {
   struct bar {
 int x;
@yaowenqiang
yaowenqiang / tmux split-window subcommand.md
Created October 11, 2022 08:42 — forked from sdondley/tmux split-window subcommand.md
Super Guide to the split-window tmux Subcommand (and Beyond)
View tmux split-window subcommand.md

Super Guide to the split-window tmux Subcommand (and Beyond)

Guide overview

tmux, like other great software, is deceptive. On the one hand, it's fairly easy to get set up and start using right away. On the other hand, it's difficult to take advantage of tmux's adanced power features without spending some quality alone time with the manual. But the problem with manuals is that they aren't geared toward beginners. They are geared toward helping seasoned developers and computer enthusiasts quickly obtain the

@yaowenqiang
yaowenqiang / notes.md
Created July 15, 2022 08:08 — forked from ian-whitestone/notes.md
Best practices for presto sql
View notes.md

Presto Specific

  • Don’t SELECT *, Specify explicit column names (columnar store)
  • Avoid large JOINs (filter each table first)
    • In PRESTO tables are joined in the order they are listed!!
    • Join small tables earlier in the plan and leave larger fact tables to the end
    • Avoid cross joins or 1 to many joins as these can degrade performance
  • Order by and group by take time
    • only use order by in subqueries if it is really necessary
  • When using GROUP BY, order the columns by the highest cardinality (that is, most number of unique values) to the lowest.