Skip to content

Instantly share code, notes, and snippets.

@Vostbur
Vostbur / podfm_autologin.py
Created March 30, 2013 18:37
POST request for login to http://podfm.ru
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib
import urllib2
import cookielib
LOGIN, PASSWORD = 'username', 'password'
cookie = cookielib.CookieJar()
@Vostbur
Vostbur / lame_mp3.py
Created April 6, 2013 16:03
Encode wav to mp3 with LAME
#!/usr/bin/env python
# coding: utf-8
import sys, subprocess
# Get LAME bundler for Windows from
# http://www.rarewares.org/mp3-lame-bundle.php
cmd = 'lame --preset insane %s' % sys.argv[1]
subprocess.call(cmd, shell=True)
@Vostbur
Vostbur / addcover.py
Created March 11, 2014 13:23
Add cover to ID3v2 tags
from mutagen.mp3 import MP3
from mutagen.id3 import ID3, APIC, error
audio = MP3('music.mp3', ID3=ID3)
# add ID3 tag if it doesn't exist
try:
audio.add_tags()
except error:
pass
@Vostbur
Vostbur / from_wav_to_mp3.py
Created March 15, 2014 18:40
Convert from wav to mp3 with pydub module
#!/usr/bin/env python
# coding: utf-8
from pydub import AudioSegment
podcast = AudioSegment.from_wav("Recording.wav")
podcast.export("podcast_processed.mp3")
@Vostbur
Vostbur / SimpleHTTPServerWithUpload.py
Last active August 29, 2015 14:08 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple HTTP server with upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
For use on Android install APK SL4A + PythonForAndroid
https://code.google.com/p/android-scripting/
"""
@Vostbur
Vostbur / webserver_v2.py
Created October 28, 2014 14:02
В браузере kindle (или любого другого устройства) показывает обновляемые скриншоты с компьютера, на котором запущен скрипт (веб-сервер).
#!/usr/bin/python
#eMonitor by Kranu
#Version 2 (9-1-2011)
#Tested on Windows 7 x64, Python 2.7.2, wxPython 2.8
#For more information, see: http://www.mobileread.com/forums/showthread.php?p=1726641#post1726641
# need wxPython
# http://www.wxpython.org/download.php#stable
@Vostbur
Vostbur / main.py
Created January 27, 2015 10:04
Generate json with changes in WebDAV folder (or other folder)
#!/usr/bin/env python
####################
# Generate json with changes in WebDAV folder (or other folder)
#
# used some code from: http://thomassileo.com/blog/2013/12/12/tracking-changes-in-directories-with-python/
# tested with python 2.7
#
# edit crontab: sudo crontab -e
# example: */1 * * * * /path-to-script/main.py
@Vostbur
Vostbur / webdav_upload.py
Created February 10, 2015 14:26
Upload file to WebDAV with Digest authentication and HTTP PUT
import requests
from requests.auth import HTTPDigestAuth
import sys
if __name__ == '__main__':
fname = sys.argv[0]
with open(fname) as f:
payload = f.read()
@Vostbur
Vostbur / get_auphonic_json.py
Created February 18, 2015 14:38
Example auphonic API (get json)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import json
if sys.version_info < (3, 0, 0):
from codecs import open
try:
@Vostbur
Vostbur / simple_task_manager.py
Created January 11, 2020 12:34
Very small and simple task manager
# -*- coding: utf-8 -*-
import re
import sys
tasks = set()
pattern = re.compile(r"/\w+")
def del_task(text):
global tasks