Skip to content

Instantly share code, notes, and snippets.

@cinaral
cinaral / startup.jl
Last active March 20, 2024 17:34
Julia startup.jl
# This file should contain site-specific commands to be executed on Julia startup;
# Users may store their own personal commands in `~/.julia/config/startup.jl`.
using Pkg
if isfile("Project.toml")
Pkg.activate(".")
end
using OhMyREPL, Revise

To mount /d/:

sudo mkdir /mnt/d
sudo mount -t drvfs D: /mnt/d

To unmount /d/:

sudo umount /mnt/d
sudo rmdir /mnt/d
@cinaral
cinaral / cd_here.sh
Last active January 10, 2023 20:09
Robustly change the working directory to the script directory
#* Hide popd and pushd stdout by defining new commands.
popdq () {
command popd "$@" > /dev/null
}
pushdq () {
command pushd "$@" > /dev/null
}
#* Change the cwd to the script dir temporarily until the script exits for any reason.
#* (If it exists use BASH_SOURCE, otherwise fall back to $0.)
trap popdq EXIT
@cinaral
cinaral / bad_interpreter.md
Created December 20, 2022 17:33
Fix /bin/bash^M: bad interpreter: No such file or directory

/bin/bash^M: bad interpreter: No such file or directory

error probably means your file was last edited by an CRLF editor. In VS Code, you can freely choose between CRLF and LF at any time and save the file to convert between the types. Fixes are:

  1. Open the file in a LF editor and overwrite, or
  2. (If using VS Code) Change "Select end of line sequence" to LF (bottom right on the task bar), or
  3. Remove " \r (Carriage Return)" from the file:
sed -i -e 's/\r$//' file.sh
@cinaral
cinaral / .clangd
Last active December 6, 2022 19:45
Clangd disable deduced types
InlayHints:
Enabled: Yes
ParameterNames: Yes
DeducedTypes: No
@cinaral
cinaral / headless_mint.md
Created November 23, 2022 03:33
Headless Linux Mint (Mint 21 Xfce w/o lightdm)

Download and install Mint 21 Xfce.

Enable ssh if you have not:

sudo apt install openssh-server
sudo systemctl enable ssh

Turn off lightdm:

sudo systemctl disable lightdm