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
psql -d core -U dave -c "\copy saps from /home/dave/Desktop/SAPS/data.csv delimiter ',' csv header;" |
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
# Install the following packages from the command line and the option will appear. | |
sudo apt-get install network-manager-openconnect network-manager-openconnect-gnome |
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
OK, after a lot of heartache, I've solve this. As usual, the solution was painfully simple. | |
Certifi uses it's own bundled certificate bundle, so you can use the one from here: https://curl.haxx.se/ca/cacert.pem | |
Basically, download it (or use your own from the certifi dist directory) | |
Then, set the env variable (in /etc/envirnoment if you're on Ubuntu like me) for $SSL_CERT_FILE to the one you downloaded: | |
export SSL_CERT_FILE=/home/yourname/cacert.pem | |
Worked immediately from main system CLI. I had to uninstall PyCharm and reinstall it for it to pick up the env variable and start working in virtualenvs again. | |
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
Comment out or set the IP of the bind address manually in /etc/mysql/my.cnf | |
Restart the service. | |
Create the user AGAIN (Because MySQL treats users on localhost and users on remote as different) | |
CREATE USER 'username'@'%' IDENTIFIED BY 'password'; | |
GRANT ALL PRIVILEGES ON *.* TO 'username'@'%'; |
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
When you build from Ubuntu, apt-get update increases the size by about 600GB. | |
Instead, don't install the recommended updates, just what you need: | |
In your docker file: | |
RUN apt-get update && apt-get install --no-install-recommends --yes python3 | |
Ref: https://ubuntu.com/blog/we-reduced-our-docker-images-by-60-with-no-install-recommends |
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 datetime import datetime, time | |
def is_time_between(begin_time, end_time): | |
# If check time is not given, default to current UTC time | |
check_time = datetime.utcnow().time() | |
if begin_time < end_time: | |
return begin_time <= check_time <= end_time | |
else: # crosses midnight | |
return check_time >= begin_time or check_time <= end_time |
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
source myprojectenv/bin/activate | |
git pull origin master | |
python manage.py makemigrations | |
python manage.py migrate | |
python manage.py collectstatic | |
sudo service gunicorn restart | |
sudo service nginx restart |
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
Set up your GPG key and add it to github by: | |
gpg --full-generate-key | |
gpg --default-new-key-algo rsa4096 --gen-key | |
Then, get your GPG ID: | |
gpg --list-secret-keys --keyid-format LONG | |
The ID is the bit after the "sec rsa4096/": | |
gpg --armor --export 3AA5C34371567BD2 |
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
Download the Editor exe here: http://dl.google.com/adwords_editor/GoogleAdsEditorSetup.exe | |
Install Wine: | |
sudo dpkg --add-architecture i386 | |
wget -O - https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add - | |
sudo add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ focal main' | |
sudo apt update; sudo apt install --install-recommends winehq-stable winetricks | |
Open Wineconfig and change the OS to Windows 10: | |
winecfg |
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
The Enum's come with some methods to translate between index and string | |
# client_service is the GoogleAdsClient object. | |
channel_types = client_service.get_type('AdvertisingChannelTypeEnum') | |
channel_types.AdvertisingChannelType.Value('SEARCH') | |
# => 2 | |
channel_types.AdvertisingChannelType.Name(2) | |
# => 'SEARCH' | |
This was found by looking at docstrings, e.g. |
NewerOlder