Skip to content

Instantly share code, notes, and snippets.

View methbkts's full-sized avatar

Metin Bektas methbkts

  • Breakly
  • Paris, France
  • 08:28 (UTC +01:00)
View GitHub Profile
@methbkts
methbkts / fetch.js
Created November 5, 2019 16:15
Sample to Fetch API
fetch('some-url')
.then(handleResponse)
.then(data => console.log(data))
.catch(error => console.log(error))
function handleResponse (response) {
let contentType = response.headers.get('content-type')
if (contentType.includes('application/json')) {
return handleJSONResponse(response)
} else if (contentType.includes('text/html')) {
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com

Numbers :

type description range length exemple
tinyint -128 to 127 (0-255) 28
smallint -32768 to 32767 (0-65535) 216
mediumint -8388608 to 8388607 (0-16777215) 224 ---
int -2147483648 to 2147483647 (0-4294967295) 232 ---
bigint -9223372036854775808 to 9223372036854775807 (0-18446744073709551615) 264 ---
decimal store exact numeric values, best for business uses --- --- ---
sudo a2enmod rewrite
sudo vim /etc/apache2/sites-available/000-default.conf
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
@methbkts
methbkts / Change MySQL root password
Last active September 5, 2019 12:17
How to change MySQL root password in Ubuntu Bionic (dev, don't use in production)
sudo mysql -uroot
mysql> USE mysql;
mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '0000';
mysql> exit;
sudo service mysql restart
@methbkts
methbkts / bionic.sh
Last active January 10, 2024 14:56
#!/bin/bash
#Quel ip?
echo -n "Entrez l'adresse ip que vous desirez utiliser : 192.168.33."
read -n 2 ip
echo
cat > Vagrantfile << eof
# -*- mode: ruby -*-
# vi: set ft=ruby :
#!/bin/bash
#Quel ip?
echo -n "Entrez l'adresse ip que vous desirez utiliser : 192.168.33."
read -n 2 ip
echo
cat > Vagrantfile << eof
# -*- mode: ruby -*-
# vi: set ft=ruby :
#!/bin/bash
#Quel ip?
echo -n "Entrez l'adresse ip que vous desirez utiliser : 192.168.33."
read -n 2 ip
echo
cat > Vagrantfile << eof
# -*- mode: ruby -*-
# vi: set ft=ruby :
#!/usr/bin/env bash
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
@methbkts
methbkts / keybase.md
Created August 6, 2019 21:36

Keybase proof

I hereby claim:

  • I am methbkts on github.
  • I am methbkts (https://keybase.io/methbkts) on keybase.
  • I have a public key ASCWDnfFT8kJ96Q4v3qmjx1EF0jY_Mq_PcQYy2Z0s6i9Wgo

To claim this, I am signing this object: