Skip to content

Instantly share code, notes, and snippets.

View ctgnauh's full-sized avatar

Tristan Huang ctgnauh

View GitHub Profile
@masdude
masdude / readme.txt
Last active May 5, 2023 12:13
小容量MBP外接固态硬盘扩容解决方案
针对小容量mac book扩容的解决方案
需要购买:
1.nvme硬盘盒
2.大容量 nvme固态硬盘(推荐500G以上容量)
推荐下面这种侧插式nvme硬盘盒,完美匹配mac book,速度是10Gb/s,而且关机也不用取下。
缺点是要占用一边两个雷电接口,硬盘盒自带一个充电接口,
算下来其实还好,不充电的情况下,多占了一个雷电接口。
import requests
from uuid import uuid4
import json
headers = {"X-GatewaySession":"[REDACTED]", "X-ClientVersion":'dev'}
data = {
"jsonrpc": '2.0',
"method": "Companion.initApp",
"params": {"locale": "en_US", "fallbackLocale": "en-GB"},
"id": str(uuid4())
@otaon
otaon / 000_how-to-construct-environment-for-common-lisp.md
Last active July 23, 2022 08:52
vim と slimv と roswell と swank で common lisp を書く環境を作る

本記事の位置づけ

下記を実現するための手順書。

  • roswell(lisp実行環境構築ツール)を導入する
  • slimv(VimにおけるSLIME)を導入する
  • roswellとslimvでcommon lispをコーディング、実行するための設定をする

手順一覧

下記の順番に環境構築する。

@cscalfani
cscalfani / ThinkAboutMonads.md
Last active December 4, 2022 20:58
How to think about monads

How to think about Monads

UPDATE 2021: I wrote this long before I wrote my book Functional Programming Made Easier: A Step-by-step Guide. For a much more in depth discussion on Monads see Chapter 18.

Initially, Monads are the biggest, scariest thing about Functional Programming and especially Haskell. I've used monads for quite some time now, but I didn't have a very good model for what they really are. I read Philip Wadler's paper Monads for functional programming and I still didnt quite see the pattern.

It wasn't until I read the blog post You Could Have Invented Monads! (And Maybe You Already Have.) that I started to see things more clearly.

This is a distillation of those works and most likely an oversimplification in an attempt to make things easier to understand. Nuance can come later. What we need when first le

@tzmartin
tzmartin / m3u8-to-mp4.md
Last active May 21, 2024 12:06
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
@swillits
swillits / Keycodes.swift
Last active May 21, 2024 10:09
Swift Keyboard Keycodes
struct Keycode {
// Layout-independent Keys
// eg.These key codes are always the same key on all layouts.
static let returnKey : UInt16 = 0x24
static let enter : UInt16 = 0x4C
static let tab : UInt16 = 0x30
static let space : UInt16 = 0x31
static let delete : UInt16 = 0x33
static let escape : UInt16 = 0x35
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE