Skip to content

Instantly share code, notes, and snippets.

Individual Contributor License Agreement (CLA) Thank you for submitting your contributions to this project.

By signing this CLA, you agree that the following terms apply to all of your past, present and future contributions to the project.

License. You hereby represent that all present, past and future contributions are governed by the MIT License copyright statement.

This entails that to the extent possible under law, you transfer all copyright and related or neighboring rights of the code or documents you contribute to the project itself or its maintainers. Furthermore you also represent that you have the authority to perform the above waiver with respect to the entirety of you contributions.

@draev
draev / size.sql
Last active September 7, 2022 21:58
ClickHouse tables size
//https://kb.altinity.com/altinity-kb-useful-queries/altinity-kb-database-size-table-column-size/
WITH
(select free_space from system.disks) as free_space,
(select total_space from system.disks) as total_space
SELECT name as table,database,
max(sizebytes) as sizebytes,
max(size) as size,
concat(toString(round(sizebytes * 100 / (total_space - free_space), 2)), '%') as size_percent,
min(min_date) as min_date,
@draev
draev / keybase.md
Last active September 20, 2019 16:00

Keybase proof

I hereby claim:

  • I am draev on github.
  • I am draev (https://keybase.io/draev) on keybase.
  • I have a public key ASABRZ8GQiC27N_NJF8Bi3cpxPfuZHTZxrcHYM0cmhbwSwo

To claim this, I am signing this object:

sed -E "s/(X'[^,\)]*')/CONVERT(\1 using utf8mb4)/g" infile.sql > outfile.sql
#!/bin/bash
ps -eo rss,pid,user,command -m | awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }'
@draev
draev / memusage
Last active November 23, 2017 10:16
Memusage MacOS
#!/bin/bash
ps -eo rss,pid,user,command -m | awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }'
@draev
draev / gist:e8d5f4c78f5e03037eb07bf086436a6f
Created May 3, 2017 09:13
Run MysqlDump in Docker Container
cat dump.sql | docker exec -i mysql /usr/bin/mysql -u root --password=password database
cat ~/.ssh/id_rsa.pub | ssh host "cat >> ~/.ssh/authorized_keys"

Set username
git config --global user.name "Your Name Here"

Set e-mail
git config --global user.email "[email protected]"

Clorize and make git output pretty
git config --global color.ui true

Creating a repository