Skip to content

Instantly share code, notes, and snippets.

View vhbui02's full-sized avatar

VH vhbui02

View GitHub Profile
@vhbui02
vhbui02 / sublime-linter-error.md
Created April 21, 2023 02:16
[SublimeLinter Error] After one month i won't remember this, noted #sublimetext

/usr/bin/env: ‘node’: No such file or directory

@vhbui02
vhbui02 / nvm.md
Last active April 21, 2023 03:37
[Some common errors] I've spent so many hours identifying this shjt, DO NOT forget #fish #nvm

At the start of a Fish Shell, by default it doesn't source nvm to preserve speed.

=> By default, $PATH don't have /bin directory /home/darkswordman/.nvm/versions/node/v18.16.0/bin

Common error

Since there are programs, plugins (e.g. plugins in SublimeLinter), sometimes they need to know where node is to run some node command.

Since we only source NVM when we use one of the aliases (function aliases, NOT binary aliases), and these function aliases only exists in Fish Shell.

@vhbui02
vhbui02 / java.md
Created April 22, 2023 05:05
[Java] Some notes worth to take #java

Adding action listener

Nested class implements ActionListener and overrides actionPerformed.

public class Foo{
    Foo(){
        something.addActionListener(new ButtonListener());
    }
 //...
@vhbui02
vhbui02 / visual-paradigm.md
Created April 22, 2023 07:30
[Visual Paradigm] Some notes to increase productivity #visualparadigm #vp

Slow performance after some time?

Check your Model Explorer, there's a high chance that your root is filled with model elements from various diagram and package. By default VP will load all of root's child, except Models which are loaded when used.

=> Solution: Try to put all of them into 1 Model (this Model is added to the root)

@vhbui02
vhbui02 / fish-function.md
Last active May 2, 2023 04:25
[function command] create a function in Fish Shell #fish

function NAME [OPTIONS]; BODY; end

Options

-a or --argument-names NAMES: assign the names for each argument passed into function, there are the same arguments given in $argv

-d or --description DESCRIPTION: specify a short description.

-e or --on-event EVENT_NAME: run when EVENT_NAME is emmited. Actually, Fish shell emits the EVENT_NAME, which (EVENT_NAME) is binded to a function that use --on-event EVENT_NAME option, which (the function) is executed.

@vhbui02
vhbui02 / eval-vs-exec.md
Last active April 28, 2023 15:59
[eval vs exec] same shjt? no #fish #shell

Example

example.sh

#!/bin/bash
echo "Hello world!"

If we want to execute this script from Fish Shell, we can use either exec or eval

Using exec

@vhbui02
vhbui02 / sed.md
Last active October 16, 2023 15:34
[sed command] search and edit from file or stdin #linux

sed take inputs from a file or stdin, which means you can pipingsed ' output of other commands to sed

sed edits line-by-line and in a non-interactive way, that means all editing decisions are determined before running the command.

Syntax

sed [options] command [file-to-edit]

Printing lines

sed 'p' BSD

@vhbui02
vhbui02 / universal-variable-fish.md
Last active April 28, 2023 16:57
[Universal Variables] Very effective way to put value inside environment variables #fish

Where are universal variables stored in Fish shell?

Inside ~/.config/fish/fish_variables

*Do not edit this file directly, as your edits may be overwritten.

=> Instead, edit the variables through fish scripts or by using fish interactively.

*Do not append to universal variables in config.fish, because these variables will then get longer with each new shell instance.

@vhbui02
vhbui02 / funced.md
Last active August 26, 2023 17:03
[funced + funcsave command] edit a function interactively and save the def of a func to the user's autoload dir #fish

funced

funced [OPTION] [NAME]

funced provides an interface (an external editor like VSCode, Vim, Notepad, ... or a built-in editor) to edit the definition of the function NAME

If the $VISUAL env var is set => it will be used

If not, but $EDITOR is set => that will be used instead

@vhbui02
vhbui02 / fish-functions.md
Last active May 3, 2023 01:54
[functions command] print or erase functions, notice the 's' plural! #fish
functions [-a | --all] [-n | --names]
functions [-D | --details] [-v] FUNCTION
functions -c OLDNAME NEWNAME
functions -d DESCRIPTION FUNCTION
functions [-e | -q] FUNCTION DIR

Options to remember