Week 48 / 2022
Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- toolchamin management,
rustup
. - all tools are installed inside
~/.cargo/bin
rustup
- cargo: build tool and package manager.
- first function:
fn main(){
printlin!("Hello")
}
rustc main.rs
Python
- Python passes references-to-objects by value. pass by assignment. (???)
- python path?
python -i [file.py]
: inspect interactively after running script.functools.lur_cache()
: nonhashable- don't run
python my/script.py
, when you run this, python put the parent dir of this script in the beginning of thesys.path
not the current directory. we runpython a/main.py
, givesModuleNotFoundError
. So, your current dir not importable by default. instead, usepython -m a.main
- a
|_ main.py # a call func from b.
|_ **init**.py
- b.py
git submodule
?
$PATH
- The PATH is an environment variable which the shelluses to search for commands:
echo $PATH
. add an entry to thePATH
like so,export PATH="$PATH:Dir"
. - it specifies the directories in which executable programs are located on the machine that can be started without knowing and typing the whole path to the file on the command line.
- Persistent environment variables can be set during several separate stages: 1) login: not now! 2) opening a new terminal:
inside
~/bashrc
setexport VARIABLE="VALUE"
- get environment variable:
echo $VARAIABLE
Mysql/Mariadb
- defference between them?
- multiple tables: joins and subqueries.
- joining queries result: CTE (Common Table Expressions)
Frappe
- prepared report?
- logging:
from frappe.utils.logger import set_log_level
set_log_level("DEBUG")
logger = frappe.logger("mb", allow_site=True, file_count=50)
logger.info()
Edgedb
- All local instances are associated with a name. This name is that’s needed to connect; under the hood, the CLI stores the instance credentials (username, password, etc) on your file system in the EdgeDB config directory.
- You can also assign names to remote instances using
edgedb instance link
to bind a set of connection credentials to an instance name. This is typically used as a way to simplify connecting to remote EdgeDB database instances. - DSNs (data source names, also referred to as “connection strings”) are a convenient and flexible way to specify connection information with a simple string:
edgedb://USERNAME:PASSWORD@HOSTNAME:PORT/DATABASE
- We actually don't promote docker-compose based local development?
- There is no default password. solving the default password issue: set a password
ALTER ROLE edgedb SET password := 'password';
- You can run EdgeDB as a query engine on top of an externally hosted Postgres instance or let EdgeDB manage Postgres for you under the hood.
- With the current ENV in
docker-compose.yml
:
environment:
- EDGEDB_INSTANCE=qna_remote
- EDGEDB_SERVER_ADMIN_UI=enabled
# When EDGEDB_SERVER_SECURITY is set to insecure_dev_mode, then the TLS MODE is generate_self_signed by default.
- EDGEDB_SERVER_SECURITY=insecure_dev_mode
# when TLS MODE is set to generate_self_signed, then
# a new self-signed certificate and private key will be generated and placed in the path specified by DATADIR.
- EDGEDB_SERVER_TLS_CERT_MODE=generate_self_signed
- EDGEDB_SERVER_DATADIR=edgedb-data
use edgedb -P <published-port> instance link --trust-tls-cert <instance-name>
to connect to
- For client connection,
EDGEDB_DSN
is the recommended approach in production. The value ofEDGEDB_DSN
can also be an instance name. - EdgeDB uses a message-based binary protocol for communication between clients and servers. The protocol is supported over TCP/IP.
CA
- To enable HTTPS on your website, you need to get a certificate (a type of file) from a Certificate Authority (CA). Let’s Encrypt is a CA.
github actons
- GitHub Actions is a continuous integration and continuous delivery (CI/CD) platform.
- Events, Jobs, Steps, Actions?
- Build, Test, Deploy
- GitHub analyzes your code and shows you CI starter workflows that might be useful for your repository.
- help you automate nearly every aspect of your application development processes.
- CI:
- Your workflow contains one or more jobs which can run in sequential order or in parallel. Each job will run inside its own virtual machine runner, or inside a container, and has one or more steps that either run a script that you define or run an action, which is a reusable extension that can simplify your workflow. Each workflow is stored as a separate YAML file in your code repository, in a directory named
.github/workflows
. - Event -> Workflow
- A job is a set of steps in a workflow that execute on the same runner. Each step is either a shell script that will be executed, or an action that will be run. Steps are executed in order and are dependent on each other. Since each step is executed on the same runner, you can share data from one step to another.
- An action is a custom application for the GitHub Actions platform that performs a complex but frequently repeated task.
- HI!
name: ""
run-name: ""
on: []
jobs:
JOB-01:
- runs-on: ?
- steps:
- run: ?
- uses: provider/action@version
with:
VAR-01: VALUE?
VAR-02: VALUE?
- name: STEP-X-NAME
uses: provider/action@version
- name: STEP-y-NAME
run: ?