Skip to content

Instantly share code, notes, and snippets.

View khanh101's full-sized avatar
🎯
Focusing

nguyễn ngọc khánh khanh101

🎯
Focusing
View GitHub Profile

Recommendations for getting started on Category Theory, from emilypi, in NE Scala Slack (#category-theory), 3/14/20:

Right, so let's just go through the branches and name the suggestions:

Pure Theory

  • Categories in Context by Riehl (Mid-Advanced): this book is concise, formal, and modern. It has a slight bias towards categorical homotopy theory, but has the most correct and relatively complete approach to understanding universal properties that I've seen in any book. This approach is the key to understanding most of the theory. The exercises in this book are 👍
  • Category Theory by Awodey (Beginner-Mid): This one was mentioned. It is a straightforward, classical approach to category theory with a bias towards categorical logic. Exercises are 👋
  • Categories for the Working Mathematician by MacLane (Mid-Advanced): the standard. Read this to complete your understanding. I would recommend this book for understanding Limits + Colimits and CCC's before Riehl if its your first r
#!/usr/bin/env bash
dir="~/playlist/"
link="<url to playlist>"
yt-dlp \
--download-archive "$dir/playlist.txt" \
--ignore-errors \
--geo-bypass \
--output "$dir/%(title)s.%(id)s.%(ext)s" \
--no-overwrites \
--extract-audio --audio-format "aac" --audio-quality 0 \
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8" />
<meta name="Generator" content="Drupal 9 (https://www.drupal.org)" />
<meta name="MobileOptimized" content="width" />
<meta name="HandheldFriendly" content="true" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script>var ct_check_js_val = '0481cb40e3eec18991bf4a01f5376955';var drupal_ac_antibot_cookie_value = '0075a04c093efa8f1070e676dc07b8c264c977ef63aad754f882bcddfb4e8c0b';var ct_use_cookies = 0;var ct_capture_buffer = 0;</script>
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="https://gmpg.org/xfn/11">
<link rel="preconnect" href="https://www.googletagmanager.com/" crossorigin />
<link rel='dns-prefetch' href='https://www.googletagmanager.com/' />
<link rel="preconnect" href="https://cdn.pimylifeup.com/" crossorigin />
@khanh101
khanh101 / macos_terminal_tmux.md
Last active August 25, 2023 03:45
MacOS terminal TMUX

In MacOS default terminal, one cannot use ctrl + arrow to resize panes due to several reasons

  • MacOS 13 uses ctrl + arrow for mission control. One has to remove those keyboard shortcuts.

  • In the default terminal Settings / Profiles / Keyboard, ctrl + arrow up and ctrl + arrow down do not get assigned to any action. The appropriate actions are

    • ctrl + arrow up: \033[1;5A
    • ctrl + arrow down: \033[1;5B
  • ctrl + arrow right: \033[1;5C

@khanh101
khanh101 / cm4_fancontrol.py
Last active July 16, 2023 20:31
CM4 IO Board Fan Control
#!/usr/bin/env python
import time
import subprocess
UPPER_TEMP = 70
LOWER_TEMP = 60
FAN_SPEED_MIN = 100
FAN_SPEED_MAX = 255
# code stole from: https://stackoverflow.com/a/54018199/21613605
ones = {
0: '', 1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six',
7: 'seven', 8: 'eight', 9: 'nine', 10: 'ten', 11: 'eleven', 12: 'twelve',
13: 'thirteen', 14: 'fourteen', 15: 'fifteen', 16: 'sixteen',
17: 'seventeen', 18: 'eighteen', 19: 'nineteen'}
tens = {
2: 'twenty', 3: 'thirty', 4: 'forty', 5: 'fifty', 6: 'sixty',
7: 'seventy', 8: 'eighty', 9: 'ninety'}
@khanh101
khanh101 / pub.py
Last active March 16, 2023 17:22
video pub-sub using zmq
import time
import cv2
import zmq
INTERVAL: float = 0.03
ENCODE_PARAMS: list[int] = [
int(cv2.IMWRITE_JPEG_QUALITY), 5,
# int(cv2.IMWRITE_JPEG_PROGRESSIVE), 1,
int(cv2.IMWRITE_JPEG_OPTIMIZE), 1,
@khanh101
khanh101 / crop_video.sh
Created November 1, 2022 08:39
zoom video 1.2x and crop to origin size
ffmpeg -i input.mp4 -vf "scale=1.2*iw:-1, crop=iw/1.2:ih/1.2" output.mp4
@khanh101
khanh101 / timer.h
Last active October 31, 2022 11:39
High precision timer
//
// Created by Khanh Nguyen Ngoc on 13/4/21.
//
#ifndef __HIGH_PRECISION_TIMER_H__
#define __HIGH_PRECISION_TIMER_H__
#include<cstdint>
#include<ctime>