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
curl -i -H "Origin: http://[web app domain]" -H "Access-Control-Request-Method: GET" -X OPTIONS [target web resource] |
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
env ARCHFLAGS="-arch x86_64" LDFLAGS="-L/usr/local/opt/openssl/lib" CFLAGS="-I/usr/local/opt/openssl/include" pip install cryptography |
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
wget -m -p -E -k -K -np http://site/path/ |
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 __future__ import print_function | |
""" | |
Utilities for 256 color support in terminals. | |
Adapted from: | |
http://stackoverflow.com/questions/1403353/256-color-terminal-library-for-ruby | |
The color palette is indexed as follows: | |
0-15: System colors |
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
# export GOOGLE_APPLICATION_CREDENTIALS='credential file in JSON' | |
import arrow | |
from google.cloud import monitoring_v3 | |
from google.cloud.monitoring_v3 import enums | |
from google.cloud.monitoring_v3.types import TimeInterval, Aggregation | |
from google.api_core import exceptions | |
client = monitoring_v3.MetricServiceClient() |
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 sys | |
import arrow | |
import shelve | |
import os.path | |
from datetime import datetime, timedelta | |
# Name of the file used by PersistentScheduler to store the last run times of periodic tasks. | |
FN_CELERYBEAT = 'celerybeat-schedule' |
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 datetime | |
class Employee: | |
def __init__(self, first_name: str , last_name: str, birth: datetime, hourly_rate: int, labor_hours: int): | |
self.first_name = first_name | |
self.last_name = last_name | |
self.birth = birth | |
self._hourly_rate = hourly_rate | |
self._labor_hours = labor_hours |
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 datetime | |
class Employee: | |
// ... | |
def printForHR(self): | |
print(u'{},{},{}'.format(self.first_name, self.last_name, self.wage)) | |
def printForIT(self): | |
print(u'{},{},{}'.format(self.first_name, self.last_name, self.birth)) |
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
class EmployeePrinterForHR: | |
def printCSV(employee: Employee): | |
print(u'{},{},{}'.format(employee.first_name, employee.last_name, employee.wage)) | |
class EmployeePrinterForIT: | |
def printCSV(employee: Employee): | |
print(u'{},{},{}'.format(employee.first_name, employee.last_name, employee.birth)) |
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
class SalesPerson(Employee): | |
@property | |
def bonus(self): | |
return self._bonus | |
@bonus.setter | |
def bonus(self, bonus): | |
self._bonus = bonus |