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
| # considering model has audio_field = FileField() | |
| def some_pre_save_receiver(sender, instance, raw, using, update_fields, **kwargs): | |
| file_was_updated = False | |
| if hasattr(instance.audio_file, 'file') and isinstance(instance.audio_file.file, UploadedFile): | |
| file_was_updated = True | |
| if update_fields and "audio_file" in update_fields: |
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
| # insures auth headers are passed to flask | |
| files: | |
| "/etc/httpd/conf.d/wsgi_custom.conf": | |
| mode: "000644" | |
| owner: root | |
| group: root | |
| content: | | |
| WSGIPassAuthorization On |
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
| # | |
| # Sample JSON Object | |
| # "pending_renewal_info": [ | |
| # { | |
| # "expiration_intent": "1", | |
| # "auto_renew_product_id": "renew_product_id", | |
| # "original_transaction_id": "1000000218147500", | |
| # "is_in_billing_retry_period": "0", | |
| # "product_id": "product_id", | |
| # "auto_renew_status": "0" |
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 django.db import connection | |
| print(connection.queries) |
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
| using System.Collections; | |
| using System.Text; | |
| using UnityEngine; | |
| using UnityEngine.Events; | |
| using UnityEngine.UI; | |
| public class TextRevealer : MonoBehaviour | |
| { | |
| [UnityEngine.Header("Configuration")] | |
| public int numCharactersFade = 3; |
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
| # per terminal session | |
| # check | |
| ulimit -a | |
| # set, e.g. 4096 | |
| ulimit -n 4096 |
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 ExtendedDeviceAdmin(DeviceAdmin): | |
| actions = ("send_message", "send_bulk_message", "send_custom_message_bulk", "enable", "disable") | |
| def send_custom_message_bulk(self, request, queryset): | |
| form = None | |
| # TODO: handle situation when results from multiple pages selected (or is it handled automatically in django 2?) | |
| if 'apply' in request.POST: # if user pressed 'apply' on intermediate page |
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
| var angle = Mathf.PI/2 + Mathf.Atan2(-moveDirection.normalized.y, moveDirection.normalized.x);// * Mathf.Rad2Deg; | |
| main.startRotation = angle; //this has to be set in radians apparantly |
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
| public static class Vector2Extension | |
| { | |
| public static Vector2 Rotate(this Vector2 v, float degrees) | |
| { | |
| return Quaternion.Euler(0, 0, degrees) * v; | |
| } | |
| } |