Skip to content

Instantly share code, notes, and snippets.

View ykyang's full-sized avatar

Yi-Kun Yang ykyang

  • WDVG Engineering
  • Houston, TX, USA
View GitHub Profile
@ykyang
ykyang / git_command.md
Last active August 25, 2022 20:43
git command

Update local list of remote branches (source.)

git remote update origin --prune

After merge, keep all our changes (source), and one their change

git merge origin/main
git checkout --ours -- .
git checkout --theirs -- their_filename
@ykyang
ykyang / reStructuredText_Cheet_Sheet.rst
Last active July 13, 2021 15:05
reStructuredText Cheet Sheet
@ykyang
ykyang / genie.md
Created June 20, 2021 01:26
Genie.jl getting started

Start Genie.jl

# help
julia --project=@. bootstrap.jl -h

# start server using script
bin/server.bat

# start server manually
julia --project=@. bootstrap.jl s
@ykyang
ykyang / mount_windows_network_drives_in_wsl.md
Last active June 15, 2021 12:34
Mount Windows network drives in WSL
@ykyang
ykyang / julia_help_pager.md
Last active June 15, 2021 12:35
Display Julia help with TerminalPager

Display Julia help with TerminalPager

Scroll Julia help page with TerminalPager

using TerminalPager
pager(@doc print)

It is particularly useful for displaying DataFrame.

@ykyang
ykyang / initialize_julia.md
Created April 20, 2021 19:18
Initialize a Julia workspace

Initialize Julia Workspace

  1. Create a working directory my_home/my_project.
  2. Open the workspace with VS Code.
  3. Start Julia interpreter Ctrl-Shift-P, Julia: Start REPL
  4. ] enter package mode, Use activate . to active current directory as the working directory.
  5. Add some packages
    1. add Revise
    2. add Debugger
  6. Two files are created after adding packages. Commit both files for a workspace directory, and only Project.toml for a package directory.
@ykyang
ykyang / julia_tricks.md
Last active August 26, 2023 20:28
9+2 Cool Julia Tricks In 4 Minutes

9+2 Cool Julia Tricks In 4 Minutes

Copied from 9 Cool Julia Tricks In 4 Minutes with my own modification.

Package mode

Type ] in REPL to enter package mode.

Shell mode

Type ; in REPL to enter shell mode. Not very reliable after less type of commnd.

@ykyang
ykyang / dataset.jl
Created March 7, 2021 21:39
Simple function to retrieve R datasets
"""
dataset(dir, name)
Replace the dataset function from RDatasets. It stopped working.
"""
function dataset(dir, name)
url = "https://raw.githubusercontent.com/vincentarelbundock/Rdatasets/master/csv/$(dir)/$(name).csv"
body = HTTP.get(url).body
csv = CSV.File(body)
df = DataFrame(csv)
@ykyang
ykyang / learn_struct.jl
Created September 24, 2020 15:30
Learn Julia struct
# Run with
# include("learn_struct.jl")
# not with
# Execute File
module Allnix
mutable struct Well
Well() = (
me = new(); # new Well object
# Assign default values
me # return the new object
@ykyang
ykyang / redirect.md
Created September 24, 2020 13:27
Re-direct in bash

When Eclipse is launched from command line, it generates lots of log message. Re-direct those message to null and run in background by

eclipse &> /dev/null &