Giter Site home page Giter Site logo

cheatsheet's Introduction

cheatsheet

git

roll back file to particular commit

git checkout <hash_commit> -- <file>

merge hotfix to master

git checkout master
git merge hotfix

show config

git config --list

set local

git config --local user.email [email protected]

rename local branch

git checkout <old_name>
git branch -m <new_name>

Редактирование коммита в середине

  1. stash changes and run
git rebase --interactive HEAD~4
  1. Видим
pick ac91b6d first commit
pick 3feff7d second commit
pick f4cbf30 third commit
pick c0271e5 fourth commit

первая строчка относится в самому раннему коммиту, последняя - к самому позднему. Нужно заменить pick на e в первой строчке и выйти из редактора с сохранением. После этого можно отредактировать нужные файлы и сделать

git stash pop
git add <changed files>
git commit --amend
git rebase --continue

Go

run concrete test

go test -run=-run ^Testname$

dlv https://www.jamessturtevant.com/posts/Using-the-Go-Delve-Debugger-from-the-command-line/

Unix

current time

date

package reverse dependencies

apt-cache rdepends <package>

show last lines in file

tail -n <count> <filename>

sigterm

kill -15 [pid]

Docker

go into container

docker exec -it <container> <shell>

go into container as root

docker exec -u 0 -it <container> <shell>

dump

docker run -i --rm postgres pg_dump -h host.docker.internal -U username --password --table tablename dbname  > ~/filename.sql

restore

docker exec -i container_DB psql -v ON_ERROR_STOP=1 -U username --password dbname < ~/filename.sql

copy

docker cp filename mycontainer:filenameDest

REGEXP

alternative

one|two

Python

set venv

virtualenv -p <python_exe> --no-site-packages <dir_env>

Django

drop all migrations

  1. delete from django_migrations where app=<app_name>;
  2. drop all tables in <app_name>

Postgres

database size

SELECT pg_size_pretty(pg_database_size('dbname'));

any

ANY('{FOO,bar,%oo%}')

cheatsheet's People

Contributors

bobrovka avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.