Skip to content

Instantly share code, notes, and snippets.

View ubuntupunk's full-sized avatar
:octocat:
making coffee

DavDev Yes ubuntupunk

:octocat:
making coffee
View GitHub Profile
@ubuntupunk
ubuntupunk / gist:9ee38cfe7e21a505985861fc50be8a3a
Created September 24, 2024 10:34
prune accidental key committed to repo
$ mkdir repo_cleanup
$ cd repo_cleanup
$ git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY .
$ git filter-branch --force --index-filter \
"git rm --cached --ignore-unmatch key.txt" \
--prune-empty --tag-name-filter cat -- --all
$ echo "key.txt" >> .gitignore
$ git add .gitignore
$ git commit -m "Add key.txt to .gitignore"
$ git push origin --force --all
lazynvm() {
unset -f nvm node npm
export NVM_DIR=~/.nvm
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
}
nvm() {
lazynvm
nvm $@
}
@ubuntupunk
ubuntupunk / gist:6fb769c6a17a461eafe2c723f99bad2e
Last active February 5, 2025 09:17
compile vim with python
./configure \--with-features=huge \
--enable-multibyte \
--enable-rubyinterp=dynamic \
--enable-pythoninterp=dynamic \
--with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu/ \
--with-python-command=/usr/bin/python \
--enable-python3interp=dynamic \
--with-python-config-dir=/usr/lib/python3.9/config-3.9-x86_64-linux-gnu/ \
--with-python3-command=/usr/bin/python3 \
--enable-perlinterp=dynamic \
** Using a shell function in your .bashrc (recommended approach):
```bash
findgrep() {
find . -type f -exec grep -l "$1" {} \;
}
```
*** Or even simpler, you can use grep -r directly (more efficient):
```bash
@ubuntupunk
ubuntupunk / .vimrc
Last active July 29, 2025 10:05
Portable Lightweight VIMRC
set nocompatible " Disable vi compatibility
filetype plugin indent on " Enable filetype detection
syntax on " Enable syntax highlighting
set mouse=r " Enable mouse copy-paste, navigation
set clipboard=unamedplus " Enable clipboard
" Colorscheme and appearance
colorscheme desert " Clean, attractive colorscheme
set background=dark " Dark background for better contrast
set number " Show line numbers
gi() {
local query="$@"
local url="https://www.toptal.com/developers/gitignore/api/$query"
local result
# Fetch the .gitignore template
result=$(curl -sL "$url" 2>&1)
if [[ $? -ne 0 ]]; then
echo "Error: Failed to fetch data from $url (network or curl issue)."
return 1