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
#!/usr/bin/env python3 | |
"""See the docstring of SafeInterruptHandler. | |
Works with python3 as well. | |
""" | |
__author__ = 'Arpad Horvath' | |
import signal | |
import functools |
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
# PEP 498 -- Literal String Interpolation | |
# Works with Python 3.6 | |
i = 6 | |
j = 7 | |
print(f"{i*j} {i+j}") | |
print('\n'.join( | |
[ | |
f'{i}x{j}={i*j}' + ('\n' if j == 30 else "") |
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.test import TestCase | |
import re | |
class MyTestCase(TestCase): | |
@staticmethod | |
def remove_csfr(html_code): | |
csrf_regex = r'<input[^>]+csrfmiddlewaretoken[^>]+>' | |
return re.sub(csrf_regex, '', html_code) |
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 | |
# használat: kepatalakito fájlnév... | |
# példa: kepatalakito *.jpg | |
# Az argumentumként megadott jpg képfájlokat átalakítja (pl. más méretre). | |
# Készítette: Horváth Árpád http://harp.pythonanywhere.com | |
for i in "$@" | |
do | |
# Kiterjesztés és útvonal leszedése | |
name=`basename "$i" '.jpg'` # Leszedi a jpg kiterjesztést |
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
#! /usr/bin/env python3 | |
def main(): | |
with open("egyketto.txt") as f: | |
sorok = f.readlines() | |
print("".join([s for s in szures(sorok, "POST Data", "New host")])) | |
def szures(sorok, pluszegyes, sima): | |
kimeno_sorok = [] | |
ennyi_sort_meg = 0 |
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 math | |
def prime_factorize(n): | |
factors = [] | |
number = math.fabs(n) | |
while number > 1: | |
factor = get_next_prime_factor(number) | |
factors.append(factor) | |
number /= factor |
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 AudioRecord(models.Model): | |
file_ = models.FileField() | |
comment = models.TextField(max_length=200, blank=True) | |
class PracticingRecord(models.Model): | |
audio_record = modelf.ForeignKey(AudioRecord) | |
composition = models.ForeignKey(Composition) | |
part = models.CharField( | |
max_length=3, | |
choices=( |
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
#!/usr/bin/env python3 | |
# coding: utf-8 | |
"""Find something near a given coordinate. | |
client_id and client_secret needs a registration on FourSquare | |
pip install requests | |
""" |
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
for root, _, files in os.walk("."): | |
print('root: ', root) | |
for file in files: | |
if file.endswith(".py"): | |
with open(os.path.join(root, file)) as f: | |
b = f.read() | |
print(file, b.count('\n')) |
This file has been truncated, but you can view the full file.
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
uloc=RTP, NC & around the world | |
new TSplit: ['rtp', 'nc', '&', 'around', 'the', 'world'] | |
old TSplit: ['rtp,', '&', 'around', 'nc & around the world', 'world', 'rtp', 'the', 'nc'] | |
uloc=SOUTHERN CAMEROONS | |
new TSplit: ['southern', 'cameroons'] | |
old TSplit: ['cameroons', 'southern', 'southern cameroons'] | |
uloc=Bhopal, Madhya pradesh, India | |
new TSplit: ['bhopal', 'madhya', 'pradesh', 'india'] | |
old TSplit: ['bhopal,', 'india', 'pradesh,', 'madhya pradesh', 'bhopal', 'madhya'] | |
uloc=Malibu, CA |
OlderNewer