This file contains 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
for (( i = 1; i < 100; i++ )) | |
do | |
[ -d $i ] || echo $i | |
done |
This file contains 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
#This is a list with three names. | |
numbers = [10, 20, 50] | |
result = 0 | |
for number in numbers: | |
result = result + number | |
print("Result " + str(result) + " number:" + str(number)) | |
print("Sum is:" + str(result)) |
This file contains 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
# Dictionaries are made of key-value pairs | |
# In the example below, names are the keys and values are their ages. | |
students = {'bilal' : 15, 'ibraheem' : 19, 'luqman' : 15} | |
print(students) | |
#add a new key/value pair to the Dictionary | |
students['imad'] = 18 |
This file contains 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
#assuming centos user and apache | |
#in ubuntu, please use ubuntu:www-data | |
#chown -R ubuntu:www-data . | |
chown -R centos:apache . | |
find . -type d -exec chmod u=rwx,g=rx,o= '{}' \; | |
find . -type f -exec chmod u=rw,g=r,o= '{}' \; | |
#Ensure that the sites directory is proper | |
cd web/sites/ |
This file contains 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
def getFirstNameFromFullName(full_name): | |
# write the code to get the first name | |
# and assign it to the variable first_name | |
return first_name | |
name = "Abdullah Al Rajeh" | |
print("First name is : "+ getFirstNameFromFullName(name) ) |
This file contains 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
#!/usr/bin/env python3 | |
# Run me with sudo ./version.py > result | |
import csv | |
import sys | |
import os | |
import re | |
class VersionAnalyzer: | |
def __init__(self): | |
self.out = csv.writer(sys.stdout) |
This file contains 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
if userVerified(user): | |
sendSMS(user.mobile, "1234") | |
showOTPPage() | |
def sendSMS(recipient, message): | |
message = "OTP: " + str(message) | |
task = {"message": message, "number": recipient, "password": SMS_VENDOR_PASSWORD, | |
"username": SMS_VENDOR_USERNAME, "sender": "MY_COMPANY" } | |
resp = requests.post(SMS_VENDOR_URL, json=task) | |
if resp.status_code != 200: |
This file contains 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
function CleanCountryPage() { | |
var spreadsheet = SpreadsheetApp.getActive(); | |
spreadsheet.getRange('C1').activate(); | |
spreadsheet.getActiveRangeList().clear({contentsOnly: true, skipFilteredRows: true}); | |
spreadsheet.getRange('E2').activate(); | |
spreadsheet.getActiveRangeList().clear({contentsOnly: true, skipFilteredRows: true}); | |
spreadsheet.getRange('E5').activate(); | |
spreadsheet.getActiveRangeList().clear({contentsOnly: true, skipFilteredRows: true}); | |
spreadsheet.getRange('E12').activate(); | |
spreadsheet.getActiveRangeList().clear({contentsOnly: true, skipFilteredRows: true}); |
This file contains 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
//switch user to postgres | |
sudo su postgres | |
//Reach psql | |
postgres@elcportal-dev:/var/www/local/hafiz/cli$ psql | |
//psql with params | |
psql -h hostname -U postgres | |
//clear screen |