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
| module.exports = { | |
| apps: [ | |
| { | |
| name: "API", | |
| script: "yarn", | |
| cwd: "/home/deploy/hoang_app/current", | |
| error_file: "/home/deploy/hoang_app/logs/web.err.log", | |
| out_file: "/home/deploy/hoang_app/logs/web.out.log", | |
| // Options reference: https://pm2.io/doc/en/runtime/reference/ecosystem-file/ | |
| args: "start", |
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
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| # run: fab backup | |
| __author__ = 'fdcore' | |
| from fabric.api import env, run, get | |
| from datetime import datetime | |
| import os | |
| env.hosts = [ |
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
| # Backup | |
| docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
| # Restore | |
| cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
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
| #!/usr/bin/python3 | |
| import argparse | |
| import logging | |
| import subprocess | |
| import os | |
| import tempfile | |
| from tempfile import mkstemp | |
| import configparser | |
| import gzip |
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
| # -*- coding: utf-8 -*- | |
| """Add permissions for proxy model. | |
| This is needed because of the bug https://code.djangoproject.com/ticket/11154 | |
| in Django (as of 1.6, it's not fixed). | |
| When a permission is created for a proxy model, it actually creates if for it's | |
| base model app_label (eg: for "article" instead of "about", for the About proxy | |
| model). |
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
| <?php | |
| // Turn ON: $ wp option update cdn_baseurl https://abc123.cloudfront.net/wp-content/uploads | |
| // Turn OFF: $ wp option delete cdn_baseurl | |
| $cdn_baseurl = get_option( 'cdn_baseurl' ); | |
| if ( ! $cdn_baseurl ) { | |
| return; |
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
| <?php | |
| /** | |
| * WordPress Must Use Plugin which rewrites asset URI's to CDN77. | |
| * | |
| * This is largely inspired my Mark Jaquith's WP_Stack CDN plugin | |
| * https://github.com/markjaquith/WP-Stack/blob/master/WordPress-Dropins/wp-stack-cdn.php | |
| * | |
| * Options that should be set in wp-config.php | |
| * CDN77_ENABLE - Set to TRUE if the CDN should be enabled | |
| * CDN77_DOMAIN - The domain name for the CDN77 subdomain in use |
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
| /** | |
| * Change the URL for static files to use the CDN | |
| */ | |
| if (FIT_USE_CDN) | |
| { | |
| add_filter('theme_root_uri', 'fit_cdn_rewrite', 99, 1); | |
| add_filter('wp_get_attachment_image_src', 'fit_cdn_image_rewrite', 99, 1); | |
| add_filter('the_content', 'fit_cdn_content_rewrite', 99, 1); | |
| } |
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 icalendar import Calendar, Event | |
| def ical(request, course_id): | |
| try: | |
| # see if the course exists | |
| c = course.objects.get(id=course_id) | |
| except course.DoesNotExist: | |
| # redirect to search page in future | |
| raise Http404 | |
| postCalendarItems = c.post_set.all() |
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
| /* Woocommerce Styles */ | |
| /* | |
| A couple things to note... | |
| 1. This code was written very specifically for my base child theme so it might not work out of the box with every theme. | |
| I have it here mostly to share with anyone who might be looking to do the same thing I was. | |
| 2. I generally add my WooCommerce CSS overrides to a custom-woo.css file then use wp_enqueue_style() to call it | |
| so that it enqueues after the default WooCommerce Stylesheets |
NewerOlder