Friday, September 20, 2024

Linux commands

  Linux commands:

du -sh /directory/* --- list the size of each sub directory 


Friday, June 17, 2022

Python

 virtualenv -p /usr/bin/python3 venv

source venv/bin/activate

pip install -r requirements.txt

python3 python.py

 

requirements.txt

---

autopep8==1.6.0                                                                 
beautifulsoup4==4.10.0                                                          
bs4==0.0.1                                                                      
certifi==2021.10.8                                                              
charset-normalizer==2.0.11                                                      
click==8.0.3                                                                    
dataclasses==0.8                                                                
Flask==2.0.2                                                                    
idna==3.3                                                                       
importlib-metadata==4.8.3                                                       
itsdangerous==2.0.1                                                             
Jinja2==3.0.3                                                                   
joblib==1.1.0                                                                   
Levenshtein==0.17.0                                                             
MarkupSafe==2.0.1                                                               
numpy==1.19.5                                                                   
pycodestyle==2.8.0                                                              
PyYAML==6.0                                                                     
rapidfuzz==1.9.1                                                                
regex==2022.1.18                                                                
requests==2.27.1                                                                
scikit-learn==0.24.2                                                            
scipy==1.5.4                                                                    
soupsieve==2.3.1                                                                
threadpoolctl==3.1.0                                                            
toml==0.10.2                                                                    
typing_extensions==4.0.1                                                        
urllib3==1.26.8                                                                 
Werkzeug==2.0.2                                                                 
zipp==3.6.0 

Tuesday, April 19, 2022

GIT

How to generate diff from PR

 https://xxxx-git.yyyy.com/ppp/xxxx/pull/1323231/files

https://xxxx-git.yyyy.com/ppp/xxxx/pull/1323231.diff -- will generate diff

Thursday, March 3, 2022

Application development

Back-end:

datatabase: Snowflake, terradata, Mangodb, elastic db

Search engine: Elasticsearch is a search engine based on the Lucene library, Azure Search

 Presto (SQL query engine) -- big data query language which includes multiple sources

queries: sql,lucene

Visualization: grafana, kibana, power-bi

Data stream pipelines: Kafka, rabbitmq

 APIs:  

Flow will be top to bottom:
Grafana
|
{API}
|
Kafaka
  |
  Feed to database
  |
 Write to schema1 & schema2 (Elastic-database)

Sunday, February 6, 2022

LLVM

LLVM code snippet:

 call <2 x i64> @read128(<2 x i64>* %1) 

 at above code snippet we are mapping vector to api parameters to map it accordningly in c, we need to create datatype through attribute option as below:

typedef long long test_uint128_t __attribute__((__vector_size__(16), __aligned__(1)));

 

To list the passes an API main() in a  file hello.c goes through:

clang -c -mllvm -print-before-all -mllvm -print-after-all hello.c -mllvm -filter-print-funcs=main

 

Tell clang to emit debug info by adding the -g flag:

clang -Os -S -emit-llvm -g addition.c
 if you are interested where this line came from:

%cmp = icmp sgt i32 %x, 10, !dbg !21


You have to look for the debug entry !21:

!21 = !DILocation(line: 4, column: 9, scope: !22)

line 9 is source line numbe.

 

 

 

 

 

reference:

https://stackoverflow.com/questions/45142289/how-to-map-c-function-to-llvm-ir




Wednesday, December 1, 2021

IPV6

 Three ways of learning IPv6 address

Static, SLAAC, DHCPv6.

Default gateway is learnt through SLAAC negotiation from router through RA msgs.

 

References:

https://www.networkacademy.io/ccna/ipv6/stateless-address-autoconfiguration-slaac  -- basic slaac flow is explained in very detail

Wednesday, June 9, 2021

Assembly code

Assembly code with examples:

---

stepi ---  Step each instruction:

 

-----

lea -- assembly code operation

lea    -0x40(%rbp),%rcx
(gdb) info registers rbp
rbp            0x7fd1cd6fc850   0x7fd1cd6fc850
(gdb) info registers rcx
rcx            0x7fd1cd6fc810   140539071547408
(gdb) p/x 0x7fd1cd6fc850- 0x40
$19 = 0x7fd1cd6fc810 

----

lea (%rdi, %rdi, 4), %rax  # set %rax to %rdi + %rdi * 4

(gdb) p/x $rax + $rcx * 8
$14203 = 0x480
(gdb) p/x $rbx
$14197 = 0x480
(gdb) p/x $rax
$14198 = 0x0  
(gdb) p/x $rcx
$14199 = 0x90
 0x0000560e660e05ab <+267>:   lea    (%rax,%rcx,8),%rbx

-----

Display current instruction:

(gdb) disp/i $pc
1: x/i $pc
=> 0x55fc7df2e297 <func [__be_func...]+39>: mov    %rax,%rdi

------

Display 10 instructions from current instruction:

----------

(gdb) x/10i $pc