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
| FROM ubuntu:16.04 | |
| RUN apt-get update | |
| RUN apt-get install -y nginx php7.0-fpm supervisor && \ | |
| rm -rf /var/lib/apt/lists/* | |
| ENV nginx_vhost /etc/nginx/sites-available/default | |
| ENV php_conf /etc/php/7.0/fpm/php.ini | |
| ENV nginx_conf /etc/nginx/nginx.conf |
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
| #1 Add user without password non-interactively | |
| adduser --disabled-password --gecos "" username_new_user | |
| #2 Grant root access to the user | |
| usermod -aG sudo username_new_user | |
| #3 Create a folder named .ssh | |
| cd /home/username_new_user | |
| mkdir ~/.ssh |
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 itertools as it | |
| from operator import itemgetter | |
| logs = [] | |
| with open('mock.log') as all_logs: | |
| for line in all_logs: | |
| line = line.split(' ', 1)[1].strip() | |
| error = line[line.find("[")+1:line.find("]")] | |
| if 'Consumer' in line: |
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 urllib.request, json | |
| ip = input('Enter an IP:') | |
| if ip.strip(): | |
| url = "http://ip-api.com/json/"+ip | |
| response = urllib.request.urlopen(url) | |
| data = json.loads(response.read()) | |
| if data['status']=='success': | |
| print(data['city']+', '+data['regionName']+'('+data['country']+')') |
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 s.name | |
| FROM | |
| (SELECT CASE | |
| WHEN p1.salary<p2.salary THEN p1.salary | |
| ELSE NULL | |
| END AS derived_column | |
| FROM friends f | |
| JOIN packages p1 | |
| ON p1.id=f.id | |
| JOIN packages p2 |