Skip to content

Instantly share code, notes, and snippets.

@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@rkeithhill
rkeithhill / Optimize-PSReadlineHistory.ps1
Last active July 11, 2024 16:59
Removes duplicate and optionally short commands from your PSReadline history file
<#
.SYNOPSIS
Optimizes your PSReadline history save file.
.DESCRIPTION
Optimizes your PSReadline history save file by removing duplicate
entries and optionally removing commands that are not longer than
a minimum length
.EXAMPLE
C:\PS> Optimize-PSReadlineHistory
Removes all the duplicate commands.
@olih
olih / jq-cheetsheet.md
Last active July 16, 2024 23:02
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@CMCDragonkai
CMCDragonkai / regular_expression_engine_comparison.md
Last active July 12, 2024 00:49
Regular Expression Engine Comparison Chart

Regular Expression Engine Comparison Chart

Many different applications claim to support regular expressions. But what does that even mean?

Well there are lots of different regular expression engines, and they all have different feature sets and different time-space efficiencies.

The information here is just copied from: http://regular-expressions.mobi/refflavors.html

# GIT heart FZF
# -------------
is_in_git_repo() {
git rev-parse HEAD > /dev/null 2>&1
}
fzf-down() {
fzf --height 50% --min-height 20 --border --bind ctrl-/:toggle-preview "$@"
}
@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active July 10, 2024 00:18
Hyperlinks in Terminal Emulators
@latkin
latkin / regexinfo.ps1
Last active April 1, 2022 01:43
Regex matching helper
<#
Dumps capture group locations and names/numbers
Example:
> regexinfo 'Jenny: 555-867-5309' '(?<name>\w+):\s+(?<phone>(?:(?<area>\d{3})-)?(\d{3}-\d{4}))'
[Jenny]: [[555]-[867-5309]]
| || |
| || 1
| |area
| phone
@santisbon
santisbon / Search my gists.md
Last active July 14, 2024 18:07
How to search gists.

Enter this in the search box along with your search terms:

Get all gists from the user santisbon.
user:santisbon

Find all gists with a .yml extension.
extension:yml

Find all gists with HTML files.
language:html

@SeeminglyScience
SeeminglyScience / Enter-PSSessionWithEdit.ps1
Last active May 4, 2023 03:27
Proof of concept for "psedit" working outside of PSES.
function Enter-PSSessionWithEdit {
[CmdletBinding()]
param(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[string] $ComputerName
)
end {
$enterEventName = 'RemoteSessionEditor.Enter'
if (-not $Host.Runspace.Events.GetEventSubscribers($enterEventName)) {
@Jaykul
Jaykul / About CommandNotFoundAction.md
Last active June 26, 2024 12:23
Helpfully handling Command Not Found in PowerShell

Helpfully handling Command Not Found in PowerShell

About CommandNotFoundAction

In PowerShell there is a callback ("Action") that is called when a command lookup fails through normal means. The purpose of this callback is to allow you to add your own command-resolution, and there are a lot of community hacks out there already:

Community Implementations

  • You could add support for new command types, like