Skip to content

Instantly share code, notes, and snippets.

@toricls
toricls / lima-on-m1-mac-installation-guide.md
Last active April 25, 2024 15:30
Using Lima to run containers with containerd and nerdctl (without Docker Desktop) on M1 Macs

Lima (Linux virtual machines, on macOS) installation guide for M1 Mac.

Sep. 27th 2021 UPDATED

Now we can install patched version of QEMU via Homebrew (thank you everyone for the info!). Here is the updated instruction with it:

Used M1 Mac mini 2020 with macOS Big Sur Version 11.6.

1. Install QEMU & Lima

#!/bin/sh
hostip=$(cat /etc/resolv.conf | grep nameserver | awk '{ print $2 }')
wslip=$(hostname -I | awk '{print $1}')
port=<PORT>
PROXY_HTTP="http://${hostip}:${port}"
set_proxy(){
export http_proxy="${PROXY_HTTP}"
export HTTP_PROXY="${PROXY_HTTP}"
/** UI element heights which used in message height calculation */
textPaddingVertical: number = 7;
textPaddingHorizontal: number = 10;
timeHeight: number = 12;
timeTopMargin: number = 5;
messageContainerVerticalMargin: number = 7;
dateSeperatorVerticalMargin: number = 20;
dateSeperatorHeight: number = 15;
imageHeight: number = 170;
imageBottomMargin: number = 10;
@danielkcz
danielkcz / formik-mobx.js
Last active July 26, 2023 21:51
Formik with MobX
function useFormik(props) {
// useState to keep the same observable around without recreating it on each render
const [formik] = React.useState(() =>
mobx.observable({
values: props.initialValues || {},
touched: {}
})
)
// just mutate state, this function itself can be considered an action+reducer
@songouyang
songouyang / .yarnrc
Created January 4, 2019 04:32
yarn 使用淘宝国内镜像
sass_binary_site "https://npm.taobao.org/mirrors/node-sass/"
phantomjs_cdnurl "https://npm.taobao.org/mirrors/phantomjs/"
electron_mirror "https://npm.taobao.org/mirrors/electron/"
registry "https://registry.npm.taobao.org"
@DimitryDushkin
DimitryDushkin / configs.js
Created October 2, 2018 14:19
React Native 0.57 + Babel 7 + Typescript + Jest
// babel.config.js
module.exports = {
"presets": [
"module:metro-react-native-babel-preset",
],
"plugins": [
["module-resolver", {
"root": ["./src"],
"extensions": [".js", ".ts", ".tsx", ".ios.js", ".android.js"]
}],
@fotock
fotock / nginx.conf
Last active May 2, 2024 02:43 — forked from plentz/nginx.conf
Nginx SSL 安全配置最佳实践.
# 生成 dhparam.pem 文件, 在命令行执行任一方法:
# 方法1: 很慢
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
# 方法2: 较快
# 与方法1无明显区别. 2048位也足够用, 4096更强
openssl dhparam -dsaparam -out /etc/nginx/ssl/dhparam.pem 4096
@vasanthk
vasanthk / System Design.md
Last active May 16, 2024 20:21
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@evantoli
evantoli / GitConfigHttpProxy.md
Last active May 11, 2024 07:51
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

@harlow
harlow / golang_job_queue.md
Last active April 24, 2024 10:21
Job queues in Golang