Sunday, 6 July 2025

stock tool

06/07/2025 10% 124

ABT, AFRM, AMD, AMGN, AMZN, ANET, APH, ARM, ATI, AVGO, AXP, 

BAC, BAM, BE, BILI, BK, BPMC, BSX, C, CAH, CARR, CCL, CEG, CF, 

CFG, CFLT, CME, CMG, COHR, CTSH, CTVA, CVNA, D, DDOG, DELL, DIS, 

DKNG, DOC, DT, EMR, EQH, ETN, EVRG, EXEL, FLR, FLS, FSLR, FTI, 

FTNT, FUTU, GE, GH, GILD, GOOG, GS, HES, HOOD, HSAI, HWM, IBKR, 

ICE, JCI, JNJ, KR, LRCX, LUV, LYV, MA, MAT, MDT, META, MIR, MO, 

MS, MSFT, MTG, NDAQ, NET, NFLX, NI, NTRS, NVDA, NXT, ONON, ORCL, 

OTIS, PEGA, PHYS, PINS, PLTR, PNC, PSTG, QCOM, QXO, RBLX, RBRK, 

RCL, RF, RGC, ROKU, RPRX, RTX, SATS, SCHW, SYM, TMUS, TWLO, U, 

UBER, UPST, URBN, USB, V, VRT, VST, VZ, W, WELL, WFC, WRBY, ZS


ref

1. tradingview filter

Friday, 12 May 2023

intellij git

 1. show local change

  • open version control panel shortcut at bottom left
  • open local change tab
  • commit
  • revert
  • show diff (green add, grey delete)

2. show file history
  • vcs -> git -> show history

3. show line history
  • right click gutter and enable 'annotate'

Saturday, 25 March 2023

sql interview question

 1. find the 2nd largest value

select max(salary) as second_highest_salary
from employees
where salary < (select max(salary) from employees);

2. find total number and average value

select department_id, count(*) as total_employees, avg(salary) as average_salary
from employees
group by department_id;

3. find the employees who have the same job title as their manager

select e.employee_name, e.job_title
from employees e
join managers m on e.manager_id = m.manager_id
where e.job_title = m.job_title;

4. find the total revenue generated per month for a given year (e.g., 2022)

select extract(month from order_date) as month, sum(revenue) as total_revenue
from orders
where extract(year from order_date) = 2022
group by extract(month from order_date)
order by month

5. 万能公式

select t1.field_1,  aggregate(t2.field_2) as metric

from table_1 t1
join table_2 t2 on t1.field_3 = t2.field_4

group by t1.field_1                            //group field should be same as in select, otherwise make no sense
order by metric
limit 3

Thursday, 23 March 2023

selenium robot

 1. sections

  • lines starting with *** denote sections
  • they have a special meaning and serve as a way to organise the file
*** Settings ***
*** Variables ***
*** Test Cases ***
*** Keywords *** 

2. pre-defined keyword
  • selenium2Library comes with many predefined keywords like “Open Browser”

3. sample .robot file

*** Settings ***
Library           SeleniumLibrary

*** Variables ***
${URL}            https://the-internet.herokuapp.com/login
${BROWSER}        chrome

*** Test Cases ***
Login Test
    Open Browser To Login Page
    Input Credentials
    Verify Successful Login
    [Teardown]    Close Browser

*** Keywords ***
Open Browser To Login Page
    Open Browser    ${URL}    ${BROWSER}

Input Credentials
    Input Text    id=username    tomsmith
    Input Text    id=password    SuperSecretPassword!
    Click Button    css=button[type="submit"]

Verify Successful Login
    Wait Until Page Contains    Welcome to the Secure Area
    Location Should Be    https://the-internet.herokuapp.com/secure


reference

Monday, 20 March 2023

linux/unix interview questions

 1. difference single quote, double quote, back tick

  • single quote: preserve literal value
  • double quote: variable expansion and command substitution
  • back tick: command substitution

2. difference between >, >>, 2>
  • >: redirect stdout to file and overwrite
  • >>: redirect stdout to file and append
  • 2>: redirect stderr to file and overwrite

3. command1 & command2 & wait
  • wait for concurrent and background running commands to finish

4. trap 'rm -f /tmp/tempfile' EXIT
  • do cleanup when script exit normal/abnormally
  • put this line at beginning of script

5. difference source vs exec a script
  • source execute in current shell, afterwards variable and function remains
  • exec create subshell to execute, afterwards nothing left

6. difference test, [], [[]]
  • test and [] are the same 
  • [[]] is better

jenkins

 1. terminology

  • node: a machine that's capable of executing pipelines or jobs, both controller and agent(slave) are node
  • executor: more like a work thread on a node
  • workspace: a directory on the node where pipeline or job is run
  • pipeline vs job: pipeline is more powerful and flexible, pipeline is defined using DSL as jenkinsfile in source code repo
  • reuseNode true: same agent node and Docker container are used for all stages of the pipeline, and the workspace directory remains the same across all stages

2, use a dockerfile
  • agent { dockerfile true }
  • create dockerfile and put in root of source repo


reference

awk

 1. program structure

BEGIN {awk-commands}

/pattern/ {awk-commands}      // body

END {awk-commands}


2. variable

$0: a special variable in awk that represents the entire line


3. commands

awk -f command.awk marks.txt

awk '/a/{++cnt} END {print "Count = ", cnt}' marks.txt