Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
# -*- mode: python; coding: utf-8 -*-
assert str is not bytes
import sys
def main():
if len(sys.argv) not in (3, 4):
print('usage: {} <keyword> <path> [final_keyword]'.format(sys.argv[0]), file=sys.stderr)
#!/usr/bin/env python3
# -*- mode: python; coding: utf-8 -*-
assert str is not bytes
import sys, os, os.path
def del_prefix(s, prefix):
assert isinstance(s, str)
assert isinstance(prefix, str)
# -*- mode: sh; coding: utf-8 -*-
milanta_pict_conv__pict_conv () {
ico_width="160"
ico_height="120"
in_path="$1"
in_basename="$(basename -- "$in_path")"
in_name="${in_basename%\.*}"
in_dir="$(dirname -- "$in_path")"
@polymorphm
polymorphm / decode.sh
Created June 23, 2013 16:39
``siemens-qu-pr-decode`` is utility for decode Quoted-Printable (old Siemens non-standard dialect)
#!/usr/bin/bash
out_file="decode-out.txt"
decode_filter="$(dirname -- "$0")/siemens-qu-pr-decode"
echo "# $(date)" >"$out_file"
for arg
do
echo "--------------------------------------------------">>"$out_file"
#!/usr/bin/env python3
# -*- mode: python; coding: utf-8 -*-
#
# ОПИСАНИЕ:
#
# скрипт который должен создать "директорию-убийцу"!
#
# это такая *пустая* директория, некоторые операции внутри которой
# будут производиться очень медленно.
# see: https://gist.github.com/4686149/f5f6b978b01d886d3e5d5979208247d25202195e
#
{'messages': None,
'result': [{'building_number': 'б',
'city': 'Пенза',
'city_id': '238',
'geo_point_id': '44803',
'hotspot_about': '',
'hotspot_name': 'Иномарка, магазин',
'hotspot_phone': '',
$ curl -S -H "Referer: http://any-stupid-domain/any-stupid-path/domru.ru/wifi" http://penza.domru.ru/wifi/getPoints ; echo ; date
{ "success": 1, "result": [ { "pid": "40045", "geo_point_id": "44803", "city_id": "238", "city": "\u041f\u0435\u043d\u0437\u0430", "street": "\u043f\u0440\u043e\u0441\u043f\u0435\u043a\u0442 \u0421\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u0435\u0439", "house_number": "16", "building_number": "\u0431", "latitude": "53.219565", "longitude": "44.936776", "hotspot_type_id": "2", "hotspot_type": "\u0410\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u0438", "hotspot_name": "\u0418\u043d\u043e\u043c\u0430\u0440\u043a\u0430, \u043c\u0430\u0433\u0430\u0437\u0438\u043d", "hotspot_about": "", "hotspot_phone": "", "hotspot_website": "", "hotspot_worktime": "\u041a\u0440\u0443\u0433\u043b\u043e\u0441\u0443\u0442\u043e\u0447\u043d\u043e", "hotspot_rating": "0", "vlan": "202:3604" }, { "pid": "40038", "geo_point_id": "41528", "city_id": "238", "city": "\u041f\u0435\u043d\u0437\u0430", "street
@polymorphm
polymorphm / html_parse.py
Created November 6, 2012 22:09
HTML Parser with tag-search
# -*- mode: python; coding: utf-8 -*-
#
# Copyright 2012 Andrej A Antonov <[email protected]>.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
#!/usr/bin/env python3
# -*- mode: python; coding: utf-8 -*-
assert str is not bytes
import sys
import csv
def main():
for arg in sys.argv[1:]:
#!/usr/bin/env python
# -*- mode: python; coding: utf-8 -*-
from __future__ import absolute_import
import random, itertools
from twisted.internet import reactor, protocol, defer
from twisted.web import client, http_headers
# ********** BEGIN CONFIGURE CONSTANTS **********