Skip to content

Instantly share code, notes, and snippets.

View ik5's full-sized avatar
🎯
Focusing

ik5 ik5

🎯
Focusing
View GitHub Profile
@lizthegrey
lizthegrey / attributes.rb
Last active February 24, 2024 14:11
Hardening SSH with 2fa
default['sshd']['sshd_config']['AuthenticationMethods'] = 'publickey,keyboard-interactive:pam'
default['sshd']['sshd_config']['ChallengeResponseAuthentication'] = 'yes'
default['sshd']['sshd_config']['PasswordAuthentication'] = 'no'
@fnky
fnky / ANSI.md
Last active May 4, 2024 22:07
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@bgadrian
bgadrian / GolangCPUProfiles.sh
Last active February 28, 2024 04:05
Golang Flame graph profiles
#install FlameGraph library
cd /opt/
sudo git clone https://github.com/brendangregg/FlameGraph.git
#make it accesible from any folder
vim ~/.bashrc
##add these lines anywhere and exit vim (if you can)
export FLAMEPATH=/opt/FlameGraph
PATH=$PATH:$FLAMEPATH
@johnpmitsch
johnpmitsch / react.md
Last active July 10, 2018 03:21
React/Redux Katello walkthrough resources
@sharvit
sharvit / BreadcrumbBar.md
Last active April 26, 2018 10:14
BreadcrumbBar toturial

BreadcrumbBar

breadcrumb-bar-2

Breadcrumbs display a users location within an application hierarchy. They act as a resource to help users navigate more efficiently and provide additional context.

The Breadcrumb Switcher provides a shortcut for users to quickly navigate to parallel pages, rather than navigating back to the previous page and making a new selection.

@PeterRincker
PeterRincker / SortGroup.vim
Last active March 17, 2024 04:51
Sort groups of lines in vim
" :[range]SortGroup[!] [n|f|o|b|x] /{pattern}/
" e.g. :SortGroup /^header/
" e.g. :SortGroup n /^header/
" See :h :sort for details
function! s:sort_by_header(bang, pat) range
let pat = a:pat
let opts = ""
if pat =~ '^\s*[nfxbo]\s'
let opts = matchstr(pat, '^\s*\zs[nfxbo]')
@asukakenji
asukakenji / 0-go-os-arch.md
Last active April 24, 2024 06:51
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.17.1 darwin/amd64.

GOOS Values

GOOS Out of the Box
aix
android
@zecar
zecar / Javascript Array betterFilter.md
Last active April 20, 2017 21:27
javascript array.filter faster alternative
Array.prototype.betterFilter = function(expression) {
	var res = [];
	for(var idx=0; idx<this.length; idx++){
		var currentItem = this[idx];
		if(expression(currentItem)){
			res.push(currentItem);
		}
	}
	return res;
@dlants
dlants / denite.md
Last active March 5, 2021 06:13
denite setup with interactive ag pattern-search of project contents

Files

First things first, I want to use ag to search through my project files. Coming from fzf, I like to have two bindings for this -- one that respects my projects .gitignore and one that does not. The latter is helpful if I want to examine a built file or look at a node_module dependency while working on my js project.

I use an alias for file_rec source to toggle the -u flag on ag. Now, <C-P> searches in my git files, and <C-O> searches everything.

" denite file search (c-p uses gitignore, c-o looks at everything)
map <C-P> :DeniteProjectDir -buffer-name=git -direction=top file_rec/git<CR>
map  :DeniteProjectDir -buffer-name=files -direction=top file_rec
@knadh
knadh / zsh-elapsed-time.md
Last active April 20, 2024 06:35
Elapsed and execution time for commands in ZSH

Elapsed and execution time display for commands in ZSH

Append this to your ~/.zshrc file.

function preexec() {
 timer=$(($(date +%s%0N)/1000000))