Skip to content

Instantly share code, notes, and snippets.

View ChrisLFieldsII's full-sized avatar

Christopher Fields ChrisLFieldsII

  • Texas
View GitHub Profile
@ChrisLFieldsII
ChrisLFieldsII / script.sh
Created May 9, 2025 18:00
Save git diff to patch file
git diff > filename.patch
@ChrisLFieldsII
ChrisLFieldsII / psql-copy.md
Created January 27, 2025 15:50
PSQL copy data to local

\copy (select * from table_name limit 20) to '~/Documents/tmp.csv' With CSV DELIMITER ',' HEADER

@ChrisLFieldsII
ChrisLFieldsII / readme.md
Last active July 25, 2024 23:12
Mac default java virtual machines location

Path should be: /Library/Java/JavaVirtualMachines/

This util prints current java_home being used: /usr/libexec/java_home

Helpful SO link to manage diff versions: https://stackoverflow.com/a/26252993

@ChrisLFieldsII
ChrisLFieldsII / readme.md
Created July 22, 2024 23:08
use httrack to copy websites for offline use
@ChrisLFieldsII
ChrisLFieldsII / readme.md
Last active July 22, 2024 21:03
starting postgres via brew

To start postgresql@14 now and restart at login:

brew services start postgresql@14

Or, if you don't want/need a background service you can just run:

/opt/homebrew/opt/postgresql@14/bin/postgres -D /opt/homebrew/var/postgresql@14

@ChrisLFieldsII
ChrisLFieldsII / example.sh
Created July 14, 2024 01:08
Get last git commit message
git log -1 --oneline | cut -c 8-$COLUMNS | xargs
@ChrisLFieldsII
ChrisLFieldsII / readme.md
Created July 11, 2024 21:03
VSCode config when have multiple TS projects in one root dir
@ChrisLFieldsII
ChrisLFieldsII / webpack.config.js
Created July 11, 2024 04:21
webpack 5 config for building lambdas with TypeScript
// useful link explaining this: https://github.com/webpack/webpack/issues/13584#issuecomment-863272803
const path = require('path');
const resolveFile = (file) => path.resolve(__dirname, `${file}`);
/** @type {import('webpack').Configuration} */
module.exports = {
mode: 'production',
optimization: {
@ChrisLFieldsII
ChrisLFieldsII / webpack-typing.js
Created July 10, 2024 05:44
How to type webpack config object in javascript file
/** @type {import('webpack').Configuration} */
module.exports = {
mode: 'production',
...
};
@ChrisLFieldsII
ChrisLFieldsII / run-nvm-if-cd-into-nvmrc-dir
Created June 24, 2024 20:37
This script will run nvm use if detects cd into dir with .nvmrc file
precmd() {
if [[ $PWD == $PREV_PWD ]]; then
return
fi