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
| import java.io.*; | |
| import java.util.regex.*; | |
| public class AS32J { | |
| static public String getContents(File file) { | |
| StringBuffer contents = new StringBuffer(); | |
| try { | |
| BufferedReader input = new BufferedReader(new FileReader(file)); | |
| try { | |
| String line = null; |
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.core.paginator import Paginator, EmptyPage, PageNotAnInteger, InvalidPage | |
| from django.http import Http404 | |
| from django.utils import six | |
| from rest_framework import pagination | |
| def get_paginated_serializer(queryset, request, serializer_class, context, | |
| page_size=50, page_kwarg='page', *args, **kwargs): | |
| '''Get paginated serializer loaded with all the data''' | |
| paginator = Paginator(queryset, page_size) |
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 ItemFilter(django_filters.FilterSet): | |
| min_price = django_filters.NumberFilter(name='price', lookup_type='gte') | |
| max_price = django_filters.NumberFilter(name='price', lookup_type='lte') | |
| category = django_filters.CharFilter(name='category__slug', lookup_type='iexact') | |
| title = django_filters.MethodFilter(name='title', action='icontains_any_word_title') | |
| description = django_filters.MethodFilter(name='description', action='icontains_any_word_description') | |
| class Meta: | |
| model = Item | |
| fields = ['category', 'min_price', 'max_price', 'negotiable', 'title', 'description'] |
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 -*- | |
| # | |
| # watermark processors for django-imagekit | |
| # some inspiration from http://code.activestate.com/recipes/362879-watermark-with-pil/ | |
| # | |
| from abc import abstractmethod, ABCMeta | |
| from imagekit.lib import Image | |
| from imagekit.lib import ImageDraw, ImageColor, ImageEnhance | |
| from PIL import ImageFont |
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
| __author__ = 'EdgarT' | |
| from __future__ import unicode_literals | |
| import youtube_dl | |
| import sys | |
| class MyLogger(object): | |
| def debug(self, msg): | |
| print(msg) |
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
| #!/bin/bash | |
| set timeout 20 | |
| #Just to compare the old and new IP | |
| echo Old IP: | |
| curl "https://wtfismyip.com/text" | |
| /usr/bin/expect << EOF |
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
| Ping all AWS EC2 IPs from http://ec2-reachability.amazonaws.com/ |
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
| ECHO OFF | |
| cd /d %~dp0 | |
| for /f "tokens=2* delims= " %%F IN ('vagrant status ^| find /I "default"') DO (SET "STATE=%%F%%G") | |
| ECHO Close this window if it remains open, and http://localhost:8081 is responsive | |
| IF "%STATE%" NEQ "saved" ( | |
| ECHO Starting Vagrant VM from powered down state... | |
| vagrant up | |
| ) ELSE ( |
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
| version: '2' | |
| services: | |
| wallabag: | |
| image: wallabag/wallabag:latest | |
| restart: always | |
| ports: | |
| - "8888:80" | |
| tty: true | |
| links: | |
| - wallabag-db:wallabag-db |
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/python | |
| # -*- coding: utf-8 -*- | |
| import logging | |
| import argparse | |
| import codecs | |
| import configparser | |
| import errno | |
| import glob | |
| from operator import itemgetter |
OlderNewer