Skip to content

Instantly share code, notes, and snippets.

View ueaner's full-sized avatar

ueaner ueaner

  • Beijing, China
View GitHub Profile
@ueaner
ueaner / using-proxy-for-git-or-github.md
Last active January 19, 2025 19:11 — forked from coin8086/using-proxy-for-git-or-github.md
Use Proxy for Git/GitHub

Use Proxy for Git/GitHub

Generally, the Git proxy configuration depends on the Git Server Protocol you use. And there're two common protocols: SSH and HTTP/HTTPS. Both require a proxy setup already. In the following, I assume a SOCKS5 proxy set up on localhost:1080. But it can also be a HTTP proxy. I'll talk about how to set up a SOCKS5 proxy later.

SSH Protocol

When you do git clone ssh://[user@]server/project.git or git clone [user@]server:project.git, you're using the SSH protocol. You need to configurate your SSH client to use a proxy. Add the following to your SSH config file, say ~/.ssh/config:

ProxyCommand nc --proxy 127.0.0.1:1080 --proxy-type socks5 %h %p
@ueaner
ueaner / readline-shortcuts.md
Last active December 9, 2024 20:30 — forked from jottr/readline_shortcuts.md
readline shortcuts

Readline

GNU readline is a commonly used library for line-editing; it is used for example by Bash, FTP, and many more (see the details of [readline][5] package under "Required By" for more examples). readline is also customizable (see man page for details).

Keyboard Shortcut Description

Ctrl+l Clear the screen

Cursor Movement

@ueaner
ueaner / semantic-commit-messages.md
Created February 15, 2023 07:28 — forked from joshbuchea/semantic-commit-messages.md
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

https://github.com/chzyer/readline/blob/master/doc/shortcut.md
-- Readline-style keymap for insert mode
-- stylua: ignore start
vim.keymap.set("i", "<C-A>", "<Home>") -- 移动:行首
vim.keymap.set("i", "<C-E>", "<End>") -- 移动:行尾
vim.keymap.set("i", "<C-B>", "<Left>") -- 移动:向左一个字符
vim.keymap.set("i", "<C-F>", "<Right>") -- 移动:向右一个字符
-- :help i_CTRL-H -- 删除:光标前一个字符
vim.keymap.set("i", "<C-D>", "<Del>") -- 删除:光标后一个字符
import React, { useMemo, useReducer, createContext, useContext } from "react"
// An enum with all the types of actions to use in our reducer
enum AppActionKind {
SetDarkMode = "AppSetDarkMode",
SetLoggedin = "AppSetLoggedin",
}
// An interface for our actions
interface AppAction {
@ueaner
ueaner / [slug].js
Created April 14, 2022 19:49 — forked from agungjk/[slug].js
Crawler example on Vercel using Puppeteer and NextJS API routes
const puppeteer = require('puppeteer-core');
const cheerio = require('cheerio');
const chrome = require('chrome-aws-lambda');
export default async (req, res) => {
const slug = req?.query?.slug;
if (!slug) {
res.statusCode = 200
res.setHeader('Content-Type', 'application/json')
res.end(JSON.stringify({ id: null }))
@ueaner
ueaner / limit.maxfiles.plist
Last active March 15, 2022 05:21 — forked from tombigel/README.md
How to Change Open Files Limit on OS X and macOS Sierra (10.8 - 10.12)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>limit.maxfiles</string>
<key>ProgramArguments</key>
<array>
<string>launchctl</string>
<string>limit</string>
@ueaner
ueaner / mac-network-commands-cheat-sheet.md
Created January 19, 2022 16:20 — forked from jjnilton/mac-network-commands-cheat-sheet.md
Mac Network Commands Cheat Sheet

Disclaimer: I'm not the original author of this sheet, but can't recall where I found it. If you know the author, please let me know so I give the attribution.

Note: Since this seems to be helpful to some people, I formatted it to improve readability of the original. Also, note that this is from 2016, many things may have changed, and I don't use macOS anymore, so I probably can't help in case of questions, but maybe someone else can.

Mac Network Commands Cheat Sheet

After writing up the presentation for MacSysAdmin in Sweden, I decided to go ahead and throw these into a quick cheat sheet for anyone who’d like to have them all in one place. Good luck out there, and stay salty.

Get an ip address for en0:

@ueaner
ueaner / next-antd-saas.js
Created November 21, 2021 00:19 — forked from chitru/next-antd-saas.js
Nextjs project with antd and saas
const withCss = require('@zeit/next-css')
const withSaas = require('@zeit/next-sass')
module.exports = withCss(withSaas({
webpack: (config, { isServer }) => {
if (isServer) {
const antStyles = /antd\/.*?\/style\/css.*?/
const origExternals = [...config.externals]
config.externals = [
@ueaner
ueaner / groupcache.go
Created July 19, 2021 02:31 — forked from fiorix/groupcache.go
Simple groupcache example
// Simple groupcache example: https://github.com/golang/groupcache
// Running 3 instances:
// go run groupcache.go -addr=:8080 -pool=http://127.0.0.1:8080,http://127.0.0.1:8081,http://127.0.0.1:8082
// go run groupcache.go -addr=:8081 -pool=http://127.0.0.1:8081,http://127.0.0.1:8080,http://127.0.0.1:8082
// go run groupcache.go -addr=:8082 -pool=http://127.0.0.1:8082,http://127.0.0.1:8080,http://127.0.0.1:8081
// Testing:
// curl localhost:8080/color?name=red
package main
import (