Skip to content

Instantly share code, notes, and snippets.

A smart way to build a string:

my $curl = <<"ENDEND";
curl 'https://my-tools/endpoint' \
--data-raw '$firstId,$secondId' \
--compressed

ENDEND

@klapi85
klapi85 / Dancer.md
Created October 17, 2021 09:04
Dancer

Dancer framework - step by step:

apt-get install build-essential

cpan install Dancer2

@klapi85
klapi85 / ElasticSearch.md
Last active January 11, 2018 11:34
Podpowiedzi do Elastica

Wylistowanie indeksów:

GET /_cat/indices?v

Aliasy:

GET /_cat/aliases?v

Wyszukanie wszystkiego:

@klapi85
klapi85 / Clojure.md
Last active September 12, 2016 10:11
Clojure tests

uruchomienie testów:

lein midje :autotest

@klapi85
klapi85 / MongoDB.md
Last active March 25, 2021 11:22
MongoDB

podwójny warunek z wyrażeniem regularnym zamiast like

db.getCollection('views').find( { $and: [ { "sellerId": "16" }, { "name": /.*test.*/ } ] } )

grupowanie wpisów z określoną cechą

db.getCollection('cItems').aggregate([{$group: {_id : "$sellerId", number:  { $sum : 1} }}] )

wyrażenia regularne

@klapi85
klapi85 / mysqlDB.md
Last active September 12, 2016 14:28
MySQL DB

Statystyki

`SELECT table_schema "Name", Round(Sum(data_length + index_length) / 1024 / 1024, 1) "MB Size" FROM information_schema.tables GROUP BY table_schema;`

Inna forma

`SELECT count(*) tables, table_schema,concat(round(sum(table_rows)/1000000,2),' MB') rows, concat(round(sum(data_length)/(1024*1024*1024),2),' GB') data, concat(round(sum(index_length)/(1024*1024*1024),2),' GB') idx, concat(round(sum(data_length+index_length)/(1024*1024*1024),2),' GB') total_size, round(sum(index_length)/sum(data_length),2) idxfrac FROM information_schema.TABLES GROUP BY table_schema ORDER BY sum(data_length+index_length) DESC LIMIT 100;`

Lista procesów:

@klapi85
klapi85 / Git.md
Last active August 9, 2024 11:00
Useful Hints

Git

Kolorowanie

git config --global color.ui true

Informacje o zmianach wykonanych tylko w branchu po zmergowaniu z masterem:

git log $(git merge-base HEAD origin/master).. --oneline
@klapi85
klapi85 / UsefulLinuxOneliners.md
Last active August 9, 2024 11:06
Useful Linux Oneliners.md

UsefulLinuxOneliners

Tworzenie klucza publicznego z prywatnego

    ssh-keygen -y -f ~/sciezka/klucz.pem > ~/sciezka/klucz.pub

Pakowanie katalogu

tar -cvf - katalog | gzip -c > nazwa.tar.gz