Skip to content

Instantly share code, notes, and snippets.

View boobo94's full-sized avatar

Bogdan Alexandru Militaru boobo94

View GitHub Profile
@boobo94
boobo94 / fixCachedECDSA.md
Last active February 16, 2018 14:21
Remove the cached key for IP/DNS on the local machine:

How to fix warning about ECDSA host key

Remove the cached key for IP/DNS on the local machine:

ssh-keygen -R IP/DNS

@boobo94
boobo94 / readme.md
Created February 21, 2018 15:01
How To Add Jobs To cron Under Linux or UNIX

How Do I install or create or edit my own cron jobs?

To edit or create your own crontab file, type the following command at the UNIX / Linux shell prompt: $ crontab -e

Do I have to restart cron after changing the crontable file?

No. Cron will examine the modification time on all crontabs and reload those which have changed. Thus cron need not be restarted whenever a crontab file is modified.

Syntax of crontab (field description)

The syntax is:

@boobo94
boobo94 / readme.md
Created February 23, 2018 09:24
Connect to ftp on EC2 AWS with user and password

Here's what I did on a Ubuntu EC2:

A) Login as root using the keypairs

B) Setup the necessary users and their passwords with

$ sudo adduser USERNAME $ sudo passwd USERNAME

@boobo94
boobo94 / .htaccess
Last active March 2, 2018 09:49
Leverage browser caching
# =====================[ EXPIRES CACHING ]=====================
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
@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]
@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 / 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 / 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 / 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 / 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