Skip to content

Commit

Permalink
add kubernetes and git commands
Browse files Browse the repository at this point in the history
  • Loading branch information
francoiducat committed Jul 8, 2023
1 parent 67b862a commit 8e7d76e
Show file tree
Hide file tree
Showing 146 changed files with 118 additions and 12,439 deletions.
3 changes: 3 additions & 0 deletions content/docs/devops/_index.md
@@ -0,0 +1,3 @@
---
bookFlatSection: true
---
Expand Up @@ -89,11 +89,19 @@ Great alternative in a shortcut to search in your terminal history:

## Postgres commands

- `psql postgres` : ouvrir l'invité de commande postgres
- `psql -h localhost -U username databasename` : Se connecter à une base de données
- `postgres=# \connect databasename` : Se connecter à une base de données depuis l'invité de command postgres
- `postgres=# \dt+` : lister les tables avec leur volumétrie (dans l'invité de commande postgres)

- `psql -h localhost -U username databasename` : Connect to a database
- `psql postgres` : Open postgres prompt
- `postgres=# \list` : List databases
- `postgres=# \connect databasename` : Connect to a database from postgres prompt
- `postgres=# \dt+` : List tables with details (dans l'invité de commande postgres)
- `postgres=# DROP DATABASE db_name WITH (FORCE);` Drop database with force
- `postgres=# CREATE DATABASE my_db OWNER fducat;` Create database specific the owner
- `postgres=# SELECT usename, client_addr, application_name, count(1) FROM pg_stat_activity group by 1,2,3;`: Track user activity


# PGADMIN
SELECT pg_terminate_backend(pid) FROM pg_stat_activity
WHERE usename ='francois.ducatillon';
## Mysql commands

- `mysql -u user -p mypassword dbname` : Se connecter à une base de données
Expand Down
22 changes: 22 additions & 0 deletions content/docs/devops/day-to-day-kubernetes-command.md
@@ -0,0 +1,22 @@
## Kubernetes & Docker commands for developers

### Export pod logs
```
kubectl logs pod-name -n namespace-name >> /export/path/file.txt
```

### Use bach inside a pod
```
kubectl exec -it myPod -n myNameSpace -- /bin/bash
```

### Run container
```
docker run -p 8080:80 --name=nginx
```

### Run specific docker service

```
docker-compose up -d myDatabaseApp
```
Expand Up @@ -4,6 +4,29 @@

Here are some day to day useful git commands


### Refresh git repo after .gitignore edition

When you add a new file to the `.gitignore` it is not immediatly ignored. It stills appears on `git status`

To refresh the git repo

```
git rm -rf --cached .
```

or

```
git rm -rf --cached specifyOnlyTheFolderToResfreshInsteadOftheEntireRepo
```

### Discard changes on a file

```
git checkout fileYouDiscardChanges
```

### Show all remotes

This show origin and upstream remotes
Expand Down Expand Up @@ -55,4 +78,4 @@ git commit -am "commit message"
using pretty format
```
git log --pretty=format:"%h - %an, %ar : %s"
```
```
@@ -1,6 +1,3 @@
---
draft: true
---
# The virtuous cycle of Code Reviews

![Photo by Alvaro Reyes on Unsplash](/img/code-review.jpeg)
Expand Down
33 changes: 0 additions & 33 deletions content/docs/productivity/images-command-line.md

This file was deleted.

@@ -1,4 +1,4 @@
## Compress PDF offline with ghostscript
## Compress PDF offline

![Ghoscript_logo](https://www.ghostscript.com/images/logos/ghostscript-plus-text.png)

Expand All @@ -19,21 +19,73 @@ Check your ghoscript version
GPL Ghostscript 10.0.0 (2022-09-21)
```

### How to
### Setup

Add this command in your `.bash_profile` or `.zshrc` file

#### Setup
```
# Usage: spdf [input file] [output file] [screen*|ebook|printer|prepress]
spdf() {
gs -sDEVICE=pdfwrite -dNOPAUSE -dQUIET -dBATCH -dPDFSETTINGS=/${3:-"screen"} -dCompatibilityLevel=1.4 -sOutputFile="$2" "$1"
}
```

#### Usage
### Usage
```
spdf BigFile.pdf SmallFile.pdf ebook
```

[ghoscript]: https://www.ghostscript.com


## Image command lines

### Batch resize image

#### Usage
```
~ sips -Z 720 *.jpg
```

Adjsut max image ratio examples: 640,720,1024,1280 etc.


### Combine two images into one

#### Prerequisites
```
~ brew install imagemagick
```

#### Usage
```
~ convert +append image1.png image2.png combined_image.png
```

#### Result

#### Image 1:
![image1](/img/image1.png)
##### Image 2:
![image2](/img/image2.png)
##### Combined image:
![combined_image](/img/combined_image.png)

## Compress Video with ffmpeg

### Requirements
```
ffmpeg
```

### Usage
```
ffmpeg -i source480.mov -r 15 outputSmall.gif
```

## Gmail clean

larger_than:5m smaller_than:8M
size:5mb has:attachment
before: 2011 after:2005/04/17

63 changes: 0 additions & 63 deletions public/404.html

This file was deleted.

This file was deleted.

0 comments on commit 8e7d76e

Please sign in to comment.