This file contains 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 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 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 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 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 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; |
NewerOlder