Skip to content

Instantly share code, notes, and snippets.

View horvatha's full-sized avatar

Árpád Horváth horvatha

View GitHub Profile
#!/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
"""
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=(
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
#! /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
#!/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
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)
# 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 "")
@horvatha
horvatha / safe_keyboardinterrupt.py
Created November 3, 2012 07:06
Handle Keyboard Interrupt for critical functions
#!/usr/bin/env python3
"""See the docstring of SafeInterruptHandler.
Works with python3 as well.
"""
__author__ = 'Arpad Horvath'
import signal
import functools