Skip to content

Instantly share code, notes, and snippets.

@yaowenqiang
yaowenqiang / overview.md
Created January 22, 2024 12:14 — forked from max-itzpapalotl/overview.md
"Rust = Future<C++>" overview

Rust = Future<C++>

In this channel I introduce Rust for people who know C++ already. The videos are supposed to be short and cover only a single topic. Each video comes with a github gist, which contains all the code and commands for copy/paste, such that you can easily try out things. Furthermore, there are links to the excellent Rust documentation.

This is still work in progress. As you can see in the table below,

@yaowenqiang
yaowenqiang / auto-refresh-mendeley-token.py
Created November 8, 2023 16:06 — forked from franfabrizio/auto-refresh-mendeley-token.py
Python example using refresh token to update access token for Mendeley API using the Mendeley Python SDK
from mendeley import Mendeley
from mendeley.exception import MendeleyException
from mendeley.session import MendeleySession
# extending the MendeleySession class to do auto-token-refresh on
# token expiration. Mendeley access tokens expire after 1 hour.
class AutoRefreshMendeleySession(MendeleySession):
def __init__(self, mendeley, token, refresh_token):
super(AutoRefreshMendeleySession, self).__init__(mendeley, token)
# silly name to avoid namespace collision with oauth refresh_token() method
@yaowenqiang
yaowenqiang / Makefile
Created October 20, 2023 00:58 — forked from LiquidityC/Makefile
Generic drop in Makefile
VERSION = \"1.0.0\"
PREFIX ?= out
INCDIR = inc
SRCDIR = src
LANG = c
OBJDIR = .obj
MODULE = binary_name
CC = gcc
@yaowenqiang
yaowenqiang / docker-registry-mirrors.md
Created July 20, 2023 07:26 — forked from y0ngb1n/docker-registry-mirrors.md
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized

Docker Hub 镜像加速器

国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。Docker 官方和国内很多云服务商都提供了国内加速器服务。

Dockerized 实践 https://github.com/y0ngb1n/dockerized

配置加速地址

Ubuntu 16.04+、Debian 8+、CentOS 7+

@yaowenqiang
yaowenqiang / blockmetatwitter.md
Created June 26, 2023 13:17 — forked from dangovorenefekt/blockmetatwitter.md
Block Meta and Twitter (nginx)
@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.)
// 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!!
{

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:

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)
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