Skip to content

Instantly share code, notes, and snippets.

View minademian's full-sized avatar

Mina Demian minademian

View GitHub Profile
@minademian
minademian / ReplaceSweChar
Created April 27, 2018 11:12
replace Swedish characters
" Replace all Swedish special characters with entities.
" adapted from http://vim.wikia.com/wiki/HTML_entities
nnoremap <silent> ,r :call ReplaceSweChar()<CR>
function! ReplaceSweChar()
silent %s/Å/\&Aring;/eg
silent %s/Ö/\&Ouml;/eg
silent %s/Ä/\&Auml;/eg
silent %s/É/\&Eacute;/eg
silent %s/å/\&aring;/eg
silent %s/ö/\&ouml;/eg
@minademian
minademian / dropdown.md
Last active May 5, 2022 09:00 — forked from citrusui/dropdown.md
"Dropdowns" in Markdown
How do I dropdown?
This is how you dropdown.

<details>
<summary>How do I dropdown?</summary>
<br>
This is how you dropdown.
@minademian
minademian / duplicate-lines.regex
Created April 11, 2018 14:16
delete duplicate lines in text editor
^(.*)(\r?\n\1)+$
@minademian
minademian / ls-output-cleaner
Last active April 11, 2018 13:59
cleans up output from GCE Storage Bucket if you copy and paste from browser into text editor
\/[(\s+)\—]+Folder[(\s+)\—]+
^(.*)(\r?\n\1)+$ # search for duplicate lines in file
\: # look for character
\n # put in newline character
# Add this to your .tmux.conf
set -g mouse on
set-option -g -q mouse on
bind-key -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M"
bind-key -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M"
@minademian
minademian / wgetGah.sh
Created May 15, 2017 17:35
batch move downloaded PDFs to new dir
#!/bin/bash
srcDir="/foo/bar" # <--- change this to where you will download the files
newDir="/foo/bar/ouch" # <--- change this to where you want to move the files
url="your url"
echo "Let's download some files..."
wget -m -P $srcDir -A pdf $url
echo "going to $srcDir..."
@minademian
minademian / interactive-search-replace-vim
Created April 6, 2017 09:51
interactive search/replace in Vim
:%s/old/new/gc
git init --bare $HOME/.cfg
alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
config config --local status.showUntrackedFiles no
echo "alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'" >> $HOME/.zshrc
@minademian
minademian / sanitize-dir-listing
Created January 14, 2017 00:50
sanitize Linux directory listing
# Sanitize a Linux directory listing so that it shows files, directories, and contents of subdirectories
# useful for sending a listing in an email, IM message, or online
^\-?[a-z]+(\s) # directory bit and file permissions
[0-9]{1}(\s) # directory counter, shows how many subdirectories this file has.
[a-z]+\s # owner
[a-z]+\s+ # group
[0-9]+\s+ # filesize
[a-z]+\s+[0-9]+\s+
[0-9]+:?[0-9]+\s # date, last updated