This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
title, COUNT(title) | |
FROM | |
cities | |
GROUP BY | |
title | |
HAVING | |
COUNT(title) > 1; | |
DELETE t1 FROM cities t1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$arr = [ | |
['date' => '2019-07-31', 'total' => 4], | |
['date' => '2019-08-04', 'total' => 6], | |
['date' => '2019-08-05', 'total' => 7] | |
]; | |
$result = []; | |
foreach ($arr as $k => $item) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$json = file_get_contents('json.txt');; | |
$array = json_decode($json, true); | |
$newArray = []; | |
foreach ($array as $value) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
php artisan tinker | |
$user = new App\User(); | |
$user->password = 'passw0rt123'; | |
$user->email = '[email protected]'; | |
$user->name = 'kiminonawa'; | |
$user->save(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Generate a CSV of all the routes | |
*/ | |
Route::get('r', function() | |
{ | |
header('Content-Type: application/excel'); | |
header('Content-Disposition: attachment; filename="routes.csv"'); | |
$routes = Route::getRoutes(); | |
$fp = fopen('php://output', 'w'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql> USE mysql; | |
mysql> UPDATE user SET authentication_string=PASSWORD("linuxconfig.org") WHERE User='root'; | |
mysql> UPDATE user SET plugin="mysql_native_password" WHERE User='root'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# You should look at the following URL's in order to grasp a solid understanding | |
# of Nginx configuration files in order to fully unleash the power of Nginx. | |
# http://wiki.nginx.org/Pitfalls | |
# http://wiki.nginx.org/QuickStart | |
# http://wiki.nginx.org/Configuration | |
# | |
# Generally, you will want to move this file somewhere, and start with a clean | |
# file but keep this around for reference. Or just disable in sites-enabled. | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
headers = requests.utils.default_headers() | |
headers.update({ | |
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0', | |
}) | |
url = 'https://www.costco.com/' | |
response = requests.get(url, headers=headers) | |
soup = BeautifulSoup(response.content) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
user = 'LazadaPhilippines' | |
url = 'https://www.facebook.com/'+ user | |
response = requests.get(url) | |
soup = BeautifulSoup(response.content) | |
f = soup.find('div', attrs={'class': '_4-u3 _5sqi _5sqk'}) | |
likes=f.find('span',attrs={'class':'_52id _50f5 _50f7'}) #finding span tag inside class | |
print(likes.text) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import requests | |
from bs4 import BeautifulSoup | |
import sys | |
r = requests.get('https://www.instagram.com/kryzzzie/') | |
soup = BeautifulSoup(r.text, 'lxml') | |
script = soup.find('script', text=lambda t: t.startswith('window._sharedData')) | |
page_json = script.text.split(' = ', 1)[1].rstrip(';') |
NewerOlder