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
import sys | |
import os | |
print(sys.argv) | |
with open(sys.argv[1], 'r') as f: | |
content = f.read() | |
with open(sys.argv[1], 'w') as f: | |
f.write(content.replace(sys.argv[2], os.environ.get(sys.argv[2], ''))) |
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
import datetime | |
import subprocess | |
import requests | |
from dateutil import parser | |
from_date = datetime.datetime(year=2019, month=4, day=24) | |
a = subprocess.check_output(['pip', 'freeze']).decode('utf-8') |
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
class A(object): | |
def x(self): | |
print('A') | |
class B(A): | |
def x(self): | |
super(B, self).x() | |
print('B') |
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
""" | |
Singleton implementation | |
""" | |
class Singleton(type): | |
_instances = {} | |
def __call__(self, *args, **kwargs): | |
if self not in self._instances: |
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
from smtplib import SMTP_SSL | |
from email.mime.text import MIMEText | |
send_to = 'destination-email@gmail.com' | |
# nu uita de active https://www.google.com/settings/security/lesssecureapps | |
smtp_user = 'myfkemail@gmail.com' | |
smtp_pass = 'myfkpassword' |
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
INSERT INTO public.regions (id, name, uri) VALUES (1, 'Asia', 'asia'); | |
INSERT INTO public.regions (id, name, uri) VALUES (2, 'Europe', 'europe'); | |
INSERT INTO public.regions (id, name, uri) VALUES (3, 'Africa', 'africa'); | |
INSERT INTO public.regions (id, name, uri) VALUES (4, 'Latin America', 'latin-america'); | |
INSERT INTO public.regions (id, name, uri) VALUES (5, 'Middle East', 'middle-east'); | |
INSERT INTO public.regions (id, name, uri) VALUES (6, 'Caribbean', 'caribbean'); | |
INSERT INTO public.regions (id, name, uri) VALUES (7, 'North America', 'north-america'); |
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
INSERT INTO public.countries (id, region_id, name, short_name) VALUES (6, 1, 'Bangladesh', 'BD'); | |
INSERT INTO public.countries (id, region_id, name, short_name) VALUES (9, 4, 'Brazil', 'BR'); | |
INSERT INTO public.countries (id, region_id, name, short_name) VALUES (13, 4, 'Colombia', 'CO'); | |
INSERT INTO public.countries (id, region_id, name, short_name) VALUES (67, 2, 'Estonia', 'EE'); | |
INSERT INTO public.countries (id, region_id, name, short_name) VALUES (7, 2, 'Belarus', 'BY'); | |
INSERT INTO public.countries (id, region_id, name, short_name) VALUES (27, 2, 'Ireland', 'IE '); | |
INSERT INTO public.countries (id, region_id, name, short_name) VALUES (68, 3, 'Angola', 'AO'); | |
INSERT INTO public.countries (id, region_id, name, short_name) VALUES (2, 4, 'Argentina', 'AR'); | |
INSERT INTO public.countries (id, region_id, name, short_name) VALUES (4, 2, 'Austria', 'AT'); | |
INSERT INTO public.countries (id, region_id, name, short_name) VALUES (5, 2, 'Azerbaijan', 'AZ'); |
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
INSERT INTO client_email_providers (domain) VALUES | |
('1033edge.com'), | |
('11mail.com'), | |
('123.com'), | |
('123box.net'), | |
('123india.com'), | |
('123mail.cl'), | |
('123qwe.co.uk'), | |
('150ml.com'), | |
('15meg4free.com'), |
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
CREATE TABLE regions | |
( | |
id SERIAL PRIMARY KEY NOT NULL, | |
name VARCHAR(500), | |
uri VARCHAR(250) NOT NULL | |
); | |
INSERT INTO public.regions (id, name, uri) VALUES (1, 'Asia', 'asia'); | |
INSERT INTO public.regions (id, name, uri) VALUES (2, 'Europe', 'europe'); | |
INSERT INTO public.regions (id, name, uri) VALUES (3, 'Africa', 'africa'); |
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
<?php | |
protected function sendPushNotificationsToIos($message) { | |
$message = "test mesaj ".date("Y-m-d H:i:s"); | |
$ctx = stream_context_create(); | |
stream_context_set_option($ctx, 'ssl', 'local_cert', $_SERVER['DOCUMENT_ROOT'] . '/key/ebsNotifKey.pem'); | |
$fp = stream_socket_client('ssl://gateway.sandbox.push.apple.com:2195', | |
$err, |
NewerOlder