Skip to content

Instantly share code, notes, and snippets.

@sagewe
sagewe / sync-using-gitignore.sh
Created March 31, 2024 06:46 — forked from theothermattm/sync-using-gitignore.sh
Rsync files using .gitignore
# sync everything excluding things in .gitignore
# delete anything on target not in source
# include dotfiles and symlinks, also use compression
rsync -azP --delete --filter=":- .gitignore" . my-target-host:/my/target/directory
@sagewe
sagewe / fix-for-sudo-command-error-unable-to-initialize-pam-no-such-file-or-directory.md
Created December 5, 2023 07:13
macOS - Fix for sudo command error: "unable to initialize PAM: No such file or directory" (Intel+M1)
In most cases, the `sudo` command error `unable to initialize PAM: No such file or directory` mostly appears when the pluggable authentication module file `/etc/pam.d/sudo` was edited with a typo or wrong pam module, etc.

## Via Single-User-Mode > Terminal
If you have an older Mac, you can boot into `single-user mode`, directly into the command line mode of macOS by skipping the UI:

* Press and hold down `COMMAND + S` keys until you see commands being executed in the Terminal.
* Open the `sudo` file with `vi /Volumes/Macintosh\ - Data/etc/pam.d/`, fix what's wrong, save and close the file by switching from `INSERT` to the `COMMAND` mode with the `ESC` key, type `:wq!`, and hit `enter`.
* Close the Terminal via the menu from the top of the screen
* Restart your machine
@sagewe
sagewe / gourcevideo.sh
Created December 9, 2022 05:38 — forked from Gnzlt/gourcevideo.sh
Gource video export command
#!/bin/bash
gource \
-s .03 \
-1280x720 \
--auto-skip-seconds .1 \
--multi-sampling \
--stop-at-end \
--key \
--highlight-users \
@sagewe
sagewe / README.MD
Created July 11, 2022 07:21 — forked from RichardBronosky/README.MD
cb - A leak-proof tee to the clipboard - Unify the copy and paste commands into one intelligent chainable command.

cb

A leak-proof tee to the clipboard

This script is modeled after tee (see [man tee][2]) and works on Linux, macOS, Cygwin, WSL/WSL2

It's like your normal copy and paste commands, but unified and able to sense when you want it to be chainable.

This project started as an answer to the StackOverflow question: [How can I copy the output of a command directly into my clipboard?][3]

@sagewe
sagewe / vim-cheat-sheet.md
Created April 4, 2021 15:37 — forked from ummahusla/vim-cheat-sheet.md
Vim Cheat Sheet

Modes

Vim has two modes insertion mode and command mode. The editor begins in command mode, where the cursor movement and text deletion and pasting occur. Insertion mode begins upon entering an insertion or change command. [ESC] returns the editor to command mode (where you can quit, for example by typing :q!). Most commands execute as soon as you type them except for "colon" commands which execute when you press the ruturn key.

Quitting

  • :x Exit, saving changes
  • :q Exit as long as there have been no changes
  • ZZ Exit and save changes if any have been made
  • :q! Exit and ignore any changes

Inserting Text

@sagewe
sagewe / vim-surround使用指南.MD
Created April 4, 2021 15:31 — forked from wilon/vim-surround使用指南.MD
vim-surround使用指南,vim-surround如何使用

普通模式

命令 说明 + 示例
ds 删除括号
ds " "Hello world!" =>
Hello world!
cs 替换括号
cs "( "Hello world!" =>
(Hello world!)
cS 替换括号,括号内文本做新一行
cS "{ "Hello world!" => {     Hello world! }
@sagewe
sagewe / tmux-cheatsheet.markdown
Created April 4, 2021 15:29 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@sagewe
sagewe / tmux-cheatsheet.markdown
Created April 4, 2021 15:23 — forked from ryerh/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表 & 简明教程

注意:本文内容适用于 Tmux 2.3 及以上的版本,但是绝大部分的特性低版本也都适用,鼠标支持、VI 模式、插件管理在低版本可能会与本文不兼容。

Tmux 快捷键 & 速查表 & 简明教程

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话:

HTML Tags You Can Use on GitHub

Wherever HTML is rendered on GitHub (gists, README files in repos, comments on issues and pull requests, ...) you can use any of the HTML elements that GitHub Flavored Markdown (GFM) provides syntactic sugar for. You can either use the syntactic sugar that GFM (or other GitHub-supported markup language you're using) provides or, since Markdown can contain raw HTML, you can enter the HTML tags manually.

But GitHub also allows you to use a few HTML elements beyond what Markdown provides by entering the tags manually, and some of them are styled with CSS. Most raw HTML tags get stripped before rendering the HTML. Those tags that can be generated by GFM syntactic sugar, plus a few more, are whitelisted. These aren't documented anywhere that I can find. Here's what I've discovered so far:

<details> and <summary>

A `<detai