Skip to content

Instantly share code, notes, and snippets.

View pije76's full-sized avatar

panjianom pije76

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pije76
pije76 / gist:12f5c46cfac40f06bab1b2411923a2ce
Created September 3, 2020 19:16 — forked from craigvantonder/gist:a54702cd9bd5c2dd6e8b33c3fce8bc5b
Sublime Text 3 / Network Folder - inotify_add_watch failed: No space left on device
Takes a long time to load project folders running in a VM and the sublime console shows:
inotify_add_watch failed: No space left on device (path: /some/project/location/...)
https://github.com/google/cadvisor/issues/1581#issuecomment-367616070
sudo cat /proc/sys/fs/inotify/max_user_watches # default is 8192
sudo sysctl fs.inotify.max_user_watches=1048576 # increase to 1048576
https://github.com/google/cadvisor/issues/1581#issuecomment-436405681
@pije76
pije76 / RelatedFieldListFilter.txt
Created August 20, 2020 23:31 — forked from mirskiy/RelatedFieldListFilter.txt
RelatedFieldListFilter vs RelatedOnlyFieldListFilter
from the source:
class RelatedOnlyFieldListFilter(RelatedFieldListFilter):
def field_choices(self, field, request, model_admin):
pk_qs = model_admin.get_queryset(request).distinct().values_list('%s__pk' % self.field_path, flat=True)
return field.get_choices(include_blank=False, limit_choices_to={'pk__in': pk_qs})
ex if:
class Author(models.Model):
country = models.ForeignKey('Country')
Key Sublime Text 3.2.1 Build 3207
----- BEGIN LICENSE -----
Member J2TeaM
Single User License
EA7E-1011316
D7DA350E 1B8B0760 972F8B60 F3E64036
B9B4E234 F356F38F 0AD1E3B7 0E9C5FAD
FA0A2ABE 25F65BD8 D51458E5 3923CE80
87428428 79079A01 AA69F319 A1AF29A4
A684C2DC 0B1583D4 19CBD290 217618CD
## Sublime Text 3 Serial key build is 3176
> * Added these lines into /etc/hosts
127.0.0.1 www.sublimetext.com
127.0.0.1 license.sublimehq.com
> * Used the license key
----- BEGIN LICENSE -----
@pije76
pije76 / gist:d14771ee95fbdd271d29014ee9f81b82
Created July 25, 2020 15:58 — forked from bergantine/gist:4128679
Django Template Tag and Filter Test File. #django #djangotemplate
{# asdf #}
{# {{ var }} {% if %} ... {% endif %} #}
{{ asdf }}
<script type="text/javascript">
fruits = new Array('apples', 'oranges', 'bananas');
for (var i=0; i < fruits.length; i++) {
alert(fruits[i]);
@pije76
pije76 / ShinyForTradingStrategy.txt
Created July 23, 2020 16:58 — forked from thertrader/ShinyForTradingStrategy.txt
A Simple Shiny App for Monitoring Trading Strategies
This Shiny application is designed to help analysing trading strategies. It is an ongoing project that I improve when time allows. Feel free to get in touch should you have any suggestion.
*How to use the App as it is?
The App uses as input several csv files (one for each strategy). Each file has two columns: date and daily return. There is an example of such a file in the Github repository. The code is essentially made of 3 files.
-ui.R: controls the layout and appearance of the app
-server.R: contains the instructions needed to build the app. You can load as much strategies as you want as long as the corresponding csv file has the right format (see below).
-shinyStrategyGeneral.R: loads the required packages and launches the app
put ui.R and server.R file in a separate directory
In the server.R file change the inputPath, inputFile and keepColumns parameters to match your setting. The first two are self explanatory the third one is a list of column names within the csv file. Keep only date and daily return
This Shiny application is designed to help analysing trading strategies. It is an ongoing project that I improve when time allows. Feel free to get in touch should you have any suggestion.
*How to use the App as it is?
The App uses as input several csv files (one for each strategy). Each file has two columns: date and daily return. There is an example of such a file in the Github repository. The code is essentially made of 3 files.
-ui.R: controls the layout and appearance of the app
-server.R: contains the instructions needed to build the app. You can load as much strategies as you want as long as the corresponding csv file has the right format (see below).
-shinyStrategyGeneral.R: loads the required packages and launches the app
put ui.R and server.R file in a separate directory
In the server.R file change the inputPath, inputFile and keepColumns parameters to match your setting. The first two are self explanatory the third one is a list of column names within the csv file. Keep only date and daily return
@pije76
pije76 / login.html
Created June 11, 2020 10:34 — forked from ambivalentno/login.html
django-crispy-form with bootstrap for django-allauth login. Note: now (2014-08-05) you have to install master allauth from github to override forms.
{% load crispy_forms_tags %}
{% block content %}
{% crispy form %}
{% endblock %}
@pije76
pije76 / pagination-functions.php
Created May 17, 2020 06:06 — forked from ejntaylor/pagination-functions.php
Replace WooCommerce Default Pagination with WP-PageNavi Pagination for Woo Canvas or WooCommerce Pagination
/**
* Replace WooCommerce Default Pagination with WP-PageNavi Pagination for Woo Canvas
**/
add_action('init','alter_woo_hooks');
function alter_woo_hooks() {
remove_action( 'woocommerce_after_main_content', 'canvas_commerce_pagination', 01, 0 );
}