Skip to content

Instantly share code, notes, and snippets.

View boobo94's full-sized avatar

Bogdan Alexandru Militaru boobo94

View GitHub Profile
@boobo94
boobo94 / .pgpass
Created April 16, 2020 16:43
Back-up postgres on linux
localhost:5432:DATABASE:USER:PASSWORD
@boobo94
boobo94 / extensions
Last active April 26, 2021 08:46
vscode settings
## Display all extensions used
```bash
$ code --list-extensions | xargs -L 1 echo code --install-extension
```
## List
```
code --install-extension aeschli.vscode-css-formatter
@boobo94
boobo94 / tasks.json
Created September 14, 2018 10:01
VSCode Task to remove dead branches from localhost or remote
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Git Prune",
"type": "shell",
"command": "git fetch --prune && git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d",
"problemMatcher": []
@boobo94
boobo94 / gist:8616e84eed97a20c7ed38715fc7f8dcd
Last active August 1, 2018 15:12
Backend exercise for interview

Hi,

We have a simple exercise for you. You have to create few endpoints for a project manager tool. Firstly we have two types of users: regular users and admins.

What a regular user can do:

  • register (username, email, password, first name, last name)
  • login (username, password)
  • see details about his profile (username, email, first name, last name), just if he it's logged in, and he must only be able to view HIS profile
@boobo94
boobo94 / answers.md
Last active May 20, 2019 15:30
Full-Stack Interview Questions

2. Design Pattern Questions

1.1. Answer: https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller#Components - The model is the central component of the pattern. It is the application's dynamic data structure, independent of the user interface. It directly manages the data, logic and rules of the application. - A view can be any output representation of information, such as a chart or a diagram. Multiple views of the same information are possible, such as a bar chart for management and a tabular view for accountants. - The controller, accepts input and converts it to commands for the model or view.

  1. Answer: https://en.wikipedia.org/wiki/Object-relational_mapping
@boobo94
boobo94 / commands.md
Last active August 2, 2018 08:06
Postgres Configurations for Ubuntu

Useful commands

Show all databases \l+

Show all roles \du+

Show all tables \dt

Installing on Linux

@boobo94
boobo94 / readme.md
Last active May 11, 2018 14:29
Setup mysql to connect remotly on Ubuntu

Install Mysql on Ubuntu

  1. $ sudo apt-get update
  2. $ sudo apt-get install mysql-server Mysql will ask for root password

Use mysql

$ mysql -u root -p Will ask for root password

@boobo94
boobo94 / example-golang.conf
Last active June 25, 2018 19:42
Configure a server as proxy with apache2
<VirtualHost *:80>
# without http or https
ServerName URL_ADDRESS
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(.+)\.DOMAIN\.com$
RewriteRule ^/(.*)$ https://%1.DOMAIN.com/$1 [R=301,L]
</VirtualHost>
@boobo94
boobo94 / redirect_to_mobile_web_version.htaccess
Created February 24, 2018 08:17
Htaccess redirect to mobile version of website m.website.com
RewriteEngine on
RewriteBase /
# Check if this is the noredirect query string
RewriteCond %{QUERY_STRING} (^|&)m=0(&|$)
# Set a cookie, and skip the next rule
RewriteRule ^ - [CO=mredir:0:www.website.com]
# Check if this looks like a mobile device
# (You could add another [OR] to the second one and add in what you
# had to check, but I believe most mobile devices should send at
@boobo94
boobo94 / most_common_htaccces_rules.md
Last active March 2, 2018 09:51
Most common .htaccess rules

=====[Redirect if no https or www in a single redirect]=====

	RewriteCond %{HTTPS} off [OR]
	RewriteCond %{HTTP_HOST} !^www\.
	RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$
	RewriteRule .* https://www.%1%{REQUEST_URI} [L,NE,R=301]