Skip to content

Instantly share code, notes, and snippets.

View erikw's full-sized avatar
💭
0b011111000110

Erik Westrup erikw

💭
0b011111000110
View GitHub Profile
@erikw
erikw / _Python Refactoring Workshop.md
Last active February 28, 2025 15:54
[CS50x Python Aryaloka] Workshop: Refactoring

[CS50x Python Aryaloka] Workshop: Refactoring

We stared with the file bithday-ugly.py and the refactored version is in bithday-refactored.py with the two extra modules we created after it.

@erikw
erikw / launch.json
Last active February 18, 2025 14:51
VSCode: Python Debugger: Current File with Arguments
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Current File with Arguments",
"type": "debugpy",
"request": "launch",
@erikw
erikw / freebsd_install.sh
Last active December 13, 2024 08:24
A log of how I configured FreeBSD spring 2018 on my Intel NUC Dawson Canyon NUC7i3DNH2
#!/usr/bin/env bash
# A log of how I configured FreeBSD spring 2018 on my Intel NUC Dawson Canyon NUC7i3DNH2E (NUC7i3DNH).
# Modeline {
# vi: foldmarker={,} foldmethod=marker foldlevel=0 tabstop=4
# }
# Links {
# FreeBSD vs Linux:
# http://www.over-yonder.net/~fullermd/rants/bsd4linux/01
# Maintainer: Erik Westrup
# Reference on git checkout: https://man.archlinux.org/man/PKGBUILD.5#USING_VCS_SOURCES
pkgname=zscreen
pkgver=20160510
pkgrel=1
pkgdesc="Scrot and imgur/s3 upload zenity gui"
arch=('any')
url="https://github.com/ChrisZeta/Scrot-and-imgur-zenity-GUI"
_git_commit='e9d15e606a0d358f002d0ec45324069c5cff3c68'
@erikw
erikw / ncmpcpp-vim-keybindings
Created December 7, 2021 19:56
NPCPP Vim keybindings
#~/.config/ncmpcpp/bindings
# How to configure NCMPCPP to get Vim-like keybindings
def_key "j"
scroll_down
def_key "k"
scroll_up
def_key "h"
previous_column
@erikw
erikw / ..git-commit-status - Generate git commit message from git-status.md
Last active April 5, 2025 18:17
Generate git commit message from git-status. Will generate a commit message like "Added: file1.py file2.py file3.py Modified: file4.py file5.py Deleted: README.md Renamed: test.txt-> test2.txt". Put this in your .gitconfig.

git commit-status alias

An alias that will generate a git commit message staged changes as shown in git-status. Put this alias (section below) in your .gitconfig.

The message generated will be in the format of:

$ git status --porcelain
A file1.py
A file2.py
A file3.py
@erikw
erikw / sed-inline-s-linux-mac-compatible.sh
Last active January 18, 2022 19:48
sed inline -s compatible with both Linux and BSD/macOS
# To be compatiable with both GNU sed and the old BSD sed that macOS uses, need to set and inplace backup extension and then remove the file.
# $(sed -i -e '...' file) works with GNU sed and modern BSD. However on macOS a backup file "file-e" will be created
# Reference: https://unix.stackexchange.com/a/131940/19909
sed -i.bak -e 'expr...' file && rm file.bak
@erikw
erikw / .vim-startify-startify_custom_header
Last active November 29, 2021 18:34
vim-statify neovim/vim version in fortune
.
@erikw
erikw / unimpaired-delete.vim
Last active October 17, 2021 14:06
vim-unimpaired extended with delete ([d and ]d)
" Extend vim-unimpaired with ]d and [d to delete above and below the current line.
" See https://github.com/tpope/vim-unimpaired/issues/157
"
" Installation: put this file in
" - vim: $HOME/.vim/plugin/
" - neovim: $XDG_CONFIG_HOME/nvim/plugin/
function! s:DeleteUp(count) abort
normal! m`
normal ix
@erikw
erikw / unlink_image_github_markdown.md
Last active October 12, 2021 10:22
How to prevent automatic image link in GitHub Markdown