This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# List of running services | |
systemctl --type=service --state=running | |
# Stop service | |
sudo service name stop | |
# Remove service from startup | |
systemctl disable service name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get text from an element by CSS selector: | |
var element = document.querySelector('select[name=someName]>option:nth-child(1)'); | |
var text = element.innerText || element.textContent; | |
element.innerHTML = text; | |
# Find an element by text some_text with ignoring text formatting | |
option_el = driver.find_element(SelectBy.XPATH, f"//option[contains(.,'{some_text}')]").click() | |
# split text up to specific char (prints the first part) | |
sep = 'RAM' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select table, disk_name, partition, bytes_on_disk from system.parts order by bytes_on_disk desc | |
select table, disk_name, partition, bytes_on_disk from system.parts where table LIKE '%node0%' order by bytes_on_disk desc | |
create TABLE sl1 (id UInt64, d Date, s String, x MATERIALIZED sleepEachRow(0.5)) Engine=ReplicatedMergeTree ORDER BY id PARTITION BY toYYYYMM(d) | |
insert into table sl1 select number, number+1, number+2 from numbers(100) | |
ATTACH TABLE attached (id UInt64, d Date, s String, x MATERIALIZED sleepEachRow(2)) Engine=ReplicatedMergeTree ORDER BY id PARTITION BY toYYYYMM(d); | |
insert into attached select number, number+1, number+2 from numbers(10) | |
CREATE TABLE to_detach |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dpkg --list | |
sudo apt-get remove package_name # Then remove the given package | |
sudo apt-get purge package_name # Purge any related code | |
sudo apt-get autoremove # Then Autoremove | |
sudo apt-get clean # Finally, do a clean so you check everything is correctly removed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table metrics (metric UInt32, val Float64, time DateTime) engine = MergeTree() | |
partition by toYYYYMMDD(time) | |
order by (metric, time) | |
create table metrics (metric UInt32, val Float64, time DateTime) engine = ReplicatedMergeTree('/clickhouse/{cluster}/tables/{shard}/{database}/{table}', '{replica}') partition by toYYYYMMDD(time) order by (metric, time) | |
insert into metrics select number%4999, rand(), (toDateTime(today())+number%2880*30) from numbers(30000000); on node 1 | |
insert into metrics select number%4999, rand(), (toDateTime(today())+number%2880*30) from numbers(50000000); on node 2 | |
insert into metrics select number%4999, rand(), (toDateTime(today())+number%2880*30) from numbers(100000000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE events_local | |
( | |
created_at_date Date DEFAULT toDate(created_at), | |
sign Int8, | |
customer_id UInt64, | |
id UInt64, | |
account_id UInt64, | |
created_at DateTime, | |
uuid Nullable(FixedString(16)), | |
type Nullable(Int8) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubectl config --help # get config help | |
brew install int128/kubelogin/kubelogin # install kubelogin on Linux https://github.com/int128/kubelogin#setup | |
kubectl get pods # | |
kubectl config current-context # show current context | |
kubectl config use-context <my context> # use a context | |
kubectl config get-contexts | |
export KUBECONFIG=$KUBECONFIG:config-filename # set path to configfile | |
cp config-name ~/.kube/config # set config file as default from a folder with a config file. Valid file with the latest changes should be copied | |
kubectl get pods --context=aws-dev-tenant-a # get pods from a specified context |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create database node0; | |
CREATE TABLE node0.table0 | |
( | |
`a` Int64, | |
`b` Int64, | |
`c` Int64, | |
`d` String | |
) | |
Engine = ReplicatedMergeTree('/clickhouse/{cluster}/tables/{shard}/{database}/{table}', '{replica}') | |
PARTITION BY a % 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Query that will be executed n seconds: | |
select sleepEachRow(1) from numbers(40) | |
Kill a query process: | |
KILL QUERY WHERE query_id='{$queryId}' | |
SELECT number, sleepEachRow(1) | |
FROM system.numbers | |
LIMIT 60 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET compile_aggregate_expressions = 1; | |
SET min_count_to_compile_aggregate_expression = 0; | |
SELECT 'Test unsigned integer values'; | |
DROP TABLE IF EXISTS test_table_unsigned_values; | |
CREATE TABLE test_table_unsigned_values | |
( | |
id UInt64, |
NewerOlder