Based on here
Let's assume that your Python script is example.py:
import os
import time
import sys
import fnmatch
async function f() { | |
const fsPromises = require('fs').promises; | |
const data = await fsPromises.readFile('/tmp/data.json') | |
.catch((err) => console.error('Error: ', err)); | |
return JSON.parse(data.toString()); | |
} |
module.exports = { | |
devServer: { | |
proxy: { | |
'^/api': { | |
target: 'http://localhost:8000', | |
changeOrigin: true, | |
secure: false, | |
pathRewrite: { | |
'^/api': '/api' | |
}, |
# Compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.o | |
*.so | |
# Packages # |
d = datetime.datetime.now() | |
timezone = pytz.timezone("Asia/Taipei") | |
d_aware = timezone.localize(d) |
Based on here
Let's assume that your Python script is example.py:
import os
import time
import sys
import fnmatch
If you want to make to be the same as master
git checkout development
git reset --hard master
git push -u origin <local-branch-name>
Force your forked repo to be the same as upstream. Forces master changes into fork and throws away all changes! if no upstream remote created: git remote add upstream https://[upstream guy's repo url]
git checkout master
git pull origin master
git merge test
git push origin master
from django.db.models.signals import post_delete, pre_save | |
from django.dispatch import receiver | |
from django.db import models | |
""" Whenever ANY model is deleted, if it has a file field on it, delete the associated file too""" | |
@receiver(post_delete) | |
def delete_files_when_row_deleted_from_db(sender, instance, **kwargs): | |
for field in sender._meta.concrete_fields: | |
if isinstance(field,models.FileField): | |
instance_file_field = getattr(instance,field.name) |
If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.
Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.
If in doubt about what git is doing when you run these commands, just