Software Category Archives
there’s an app for that
30 January 2014 | Privacy, Security, Software | No Comments
ну, все уже видели, конечно (по ссылке так же есть и солайды внутренних презентаций):
The National Security Agency and its UK counterpart GCHQ have been developing capabilities to take advantage of “leaky” smartphone apps, such as the wildly popular Angry Birds game, that transmit users’ private information across the internet, according to top secret documents.
The data pouring onto communication networks from the new generation of iPhone and Android apps ranges from phone model and screen size to personal details such as age, gender and location. Some apps, the documents state, can share users’ most sensitive information such as sexual orientation – and one app recorded in the material even sends specific sexual preferences such as whether or not the user may be a swinger.
натурально, больше игр, хороших и разных.
let me see you stripped
24 January 2014 | HOWTO, Software | No Comments
или вот Newspaper, другая python-библиотека, что находит и обрабатывает заголовки и статьи в интернете, с легкостью превращая новостные сайты в забытые газеты.
хвостиком махнула
21 January 2014 | HOWTO, Software | No Comments
кстати, если вашей web-страничке надо добавить поддержку горячих клавиш, то проще всего это сделать с помощью библиотеки Mousetrap.
кто кого
18 January 2014 | Privacy, Software | No Comments
натуральная гонка вооружений:
For example, PageFair offers a free JavaScript program that, when inserted into a Web page, monitors ad blocking activity. CEO Sean Blanchfield says he developed the monitoring tool after he noticed a problem on his own multiplayer gaming site. PageFair collects statistics on ad blocking activity, identifies which users are blocking ads and can display an appeal to users to add the publisher’s website to their ad-blocking tool’s personal whitelist.
а дальше, например, можно не только сообщать об этом читателям, но и просто не открывать страницу, если включены блокировщики рекламы[1].
впрочем, другая сторона тоже не дремлет — вот, скажем, один вариант:
This extension hides your AdBlocker from Anti-AdBlock scripts on websites such as putlocker.com, watchfreeinhd.com and more.
а вот другой (и ему подобные):
Use this file to prevent your computer from connecting to selected internet hosts. This is an easy and effective way to protect you from many types of spyware, reduces bandwidth use, blocks certain pop-up traps, prevents user tracking by way of “web bugs” embedded in spam, provides partial protection to IE from certain web-based exploits and blocks most advertising you would otherwise be subjected to on the internet.
let the fun begin.
-
что в свете последних событий @ Yahoo выглядит особенно забавно. ↩
на поводке
12 January 2014 | HOWTO, Software | No Comments
для того, чтобы в OS X добавить в контекстное меню любой программы возможность искать помеченный текст с помощью Google Chrome, надо создать новый сервис: открыть Automator, в разделе Actions выбрать действие Run AppleScript и отредактировать его следующим образом:
on run {input, parameters} tell application "Chromium" open location "https://encrypted.google.com/search?pws=0&q=" & input activate end tell end run
аналогично, кстати, можно добавить и какой-нибудь сервис для работы с Markdown — хотя их, разных, и так навалом.
банки с вареньем
28 December 2013 | HOWTO, Software | No Comments
если активно изпользовать PopClip, то в одним момент с удивлением обнаруживаешь, что различных плагинов у тебя слишком много, они не помещаются рядом, стесняются друг друга и прячутся в закутках.
поэтому некоторые из них так и хочется соеднить в одно целое, связав разные действия с дополнительно зажатыми клавишами-модификаторами. что ж, реализовать подобное несложно, благо у PopClip есть специальная переменная POPCLIP_MODIFIER_FLAGS
, которая, натурально, принимает разные значения в зависимости от используемой клавиши.
выглядит это так:
#!/usr/bin/env python # Markdown tags for PopClip # By dsjkvf (2013) dsjkvf@gmail.com import sys import os def em(): sys.stdout.write ("*" + selected_text + "*") def strong(): sys.stdout.write ("**" + selected_text + "**") def quote(): sys.stdout.write ("> " + selected_text) def code(): sys.stdout.write ("`" + selected_text + "`") def tab(): sys.stdout.write (" " + selected_text) def comment(): sys.stdout.write ("<!-- " + selected_text + " -->") # get the text selected by PopClip selected_text = os.environ['POPCLIP_TEXT'] # get the tags set for the corresponding keys (from the extension's settings) cmd = os.environ['POPCLIP_OPTION_CMD'] opt = os.environ['POPCLIP_OPTION_OPT'] ctr = os.environ['POPCLIP_OPTION_CTR'] non = os.environ['POPCLIP_OPTION_NON'] # special keys: Command + Option, Command + Control cmo = os.environ['POPCLIP_OPTION_CMO'] cmr = os.environ['POPCLIP_OPTION_CMR'] # transform the settings into the functions name func_cmd = globals()[cmd] func_opt = globals()[opt] func_ctr = globals()[ctr] func_non = globals()[non] # special keys: Command + Option, Command + Control func_cmo = globals()[cmo] func_cmr = globals()[cmr] # get the key pressed key = os.environ['POPCLIP_MODIFIER_FLAGS'] if key == '1572864': func_cmo() elif key == '1310720': func_cmr() elif key == '1048576': func_cmd() elif key == '524288': func_opt() elif key == '262144': func_ctr() else: func_non()
и не забудем про свойства:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Actions</key> <array> <dict> <key>Image File</key> <string>t.png</string> <key>Script Interpreter</key> <string>/usr/bin/python</string> <key>Shell Script File</key> <string>t.py</string> <key>Title</key> <string>Tagify</string> <key>After</key> <string>paste-result</string> <key>Requirements</key> <array> <string>paste</string> </array> </dict> </array> <key>Options</key> <array> <dict> <key>Option Identifier</key> <string>non</string> <key>Option Type</key> <string>string</string> <key>Option Default Value</key> <string>em</string> <key>Option Label</key> <string>No additional key</string> </dict> <dict> <key>Option Identifier</key> <string>ctr</string> <key>Option Type</key> <string>string</string> <key>Option Default Value</key> <string>code</string> <key>Option Label</key> <string>Control (^)</string> </dict> <dict> <key>Option Identifier</key> <string>opt</string> <key>Option Type</key> <string>string</string> <key>Option Default Value</key> <string>tab</string> <key>Option Label</key> <string>Option (⌥)</string> </dict> <dict> <key>Option Identifier</key> <string>cmd</string> <key>Option Type</key> <string>string</string> <key>Option Default Value</key> <string>strong</string> <key>Option Label</key> <string>Command (⌘)</string> </dict> <dict> <key>Option Identifier</key> <string>cmo</string> <key>Option Type</key> <string>string</string> <key>Option Default Value</key> <string>quote</string> <key>Option Label</key> <string>Command + Option (⌘⌥)</string> </dict> <dict> <key>Option Identifier</key> <string>cmr</string> <key>Option Type</key> <string>string</string> <key>Option Default Value</key> <string>comment</string> <key>Option Label</key> <string>Command + Control (⌘^)</string> </dict> </array> <key>Options Title</key> <string>Select tags for key modifiers:</string> <key>Credits</key> <array> <key>Name</key> <string>dsjkvf</string> </array> <key>Extension Description</key> <string>Tags for Markdown</string> <key>Extension Identifier</key> <string>com.dsjkvf.popclip.extension.tagify</string> <key>Extension Name</key> <string>tagify</string> <key>Version</key> <integer>2</integer> </dict> </plist>
готовое расширение для опытов можно взять здесь.
not a game
26 December 2013 | Jurisprudence, Politics, Privacy, Security, Software | 1 Comment
The FBI has been able to covertly activate a computer’s camera — without triggering the light that lets users know it is recording[1] — for several years.
как насчет законодательного регулирования подобных мер? как насчет необходимости получать ордер, например?
A search warrant would be required to get content such as files from a suspect’s computer, said Mark Eckenwiler, a senior counsel at Perkins Coie LLP who until December was the Justice Department’s primary authority on federal criminal surveillance law. Continuing surveillance would necessitate an even stricter standard, the kind used to grant wiretaps.
But if the software gathers only communications-routing “metadata”—like Internet protocol addresses or the “to” and “from” lines in emails—a court order under a lower standard might suffice if the program is delivered remotely, such as through an Internet link, he said. That is because nobody is physically touching the suspect’s property, he added.
звучит отвратительно:
“Technology is evolving and law enforcement is struggling to keep up,” said Brian L. Owsley, a retired federal magistrate judge from Texas who was not involved in either case. “It’s a cat-and-mouse game.”
на диете
20 December 2013 | HOWTO, Software | 3 Comments
у каждого из нас, полагаю, есть такой новостной сайт (рассадник каких-нибудь деревенских акуталий), что совсем уж невозможно просматривать из-за окончательного засилия рекламы, аляповатого дизайна и прочих разных глупостей. что ж, дабы не рыться среди чужой безвкусицы, можно просто взять с главной страницы заголовки — и в python это легко сделать с помощью библиотеки BeautifulSoup:
#!/usr/bin/env python import sys import urllib2 from BeautifulSoup import BeautifulSoup # in order to use Beautiful Soup library version 4 # comment the above line and uncomment the one below # from bz4 import BeautifulSoup # get data from your beloved ugly website data = urllib2.urlopen('http://your.ugly.website') # parse that data soup = BeautifulSoup(data.read()) # describe the type of the output print 'Content-type: text/html\n\n' # extract headers of interest for header in soup.html.body.findAll('tags and styles go here'): # detect if the links in question are relative or absolute if '"/' in str(header): # correct relative ones print(re.sub('"/','"http://your.ugly.website',str(header))) else: print(str(header))
а для того, чтобы запустить этот скрипт на сервере, сохраните отредатированный код в файл с расширением .cgi
и добавьте в файл .htaccess
данного каталога следующие директивы:
Options +ExecCGI AddHandler cgi-script .cgi
ниже, в комментариях, так же есть и законченный пример.
на скорую руку
11 December 2013 | HOWTO, Software | No Comments
кстати, если у вас есть документ в формате Markdown, и его надо опубликовать в сети, то вместо иных конверсий и прочих адаптаций, можно воспользоваться библиотекой Strapdown.js и прилагающимися темами.
о трансплантациях
4 December 2013 | HOWTO, Software | No Comments
в силу разных привычек (безопастность, эффективность, надежность, итд) я достаточно часто использую в повседневной жизни RAM drive — скажем, чтобы держать там кэш активных программ. и вот, например, как в Mac OS X это можно применить к Chromium[1]:
#!/usr/bin/env python[2] # Create RAMDisk for Chromium's cache and extensions' temporary files # By dsjkvf (2013) dsjkvf@gmail.com import sys import os import shutil def create(): # Set the size of the RAMDisk in megabytes sizeMBytes = 500 sizeBytes = str(int(sizeMBytes) * 1953) # Create RAMDisk os.system( 'diskutil erasevolume HFS+ \"RAMDisk\" `hdiutil attach -nomount ram://'+sizeBytes+'`') def initialize(): # Enlist the directories in question dirHDDSSD = ['~/Library/Caches/Chromium/Default/Cache', '~/Library/Caches/Chromium/Default/Media Cache', ...[3]] dirRAM = ['/Volumes/RAMDisk/Chromium/Cache','/Volumes/RAMDisk/Chromium/Media Cache', ...] #Create RAMDisk directories for i in dirRAM: try: os.makedirs(os.path.expanduser(i)) except OSError, e: pass # Symlink RAMDisk directories to corresponding mountpoints on the HDD/SSD for (i,j) in zip(dirHDDSSD,dirRAM): if os.path.exists(os.path.expanduser(i)): if not os.path.islink(os.path.expanduser(i)): shutil.rmtree(os.path.expanduser(i)) os.symlink(os.path.expanduser(j), os.path.expanduser(i)) else: try: os.symlink(os.path.expanduser(j), os.path.expanduser(i)) except OSError, e: os.unlink(os.path.expanduser(i)) os.symlink(os.path.expanduser(j), os.path.expanduser(i)) # Hide the RAMDisk os.system('chflags hidden /Volumes/RAMDisk') def main(): if not len(sys.argv) > 1: create() initialize() sys.exit() else: print 'ATTENTION: No command line parameters are supposed to be used with this script.' print 'ATTENTION: Please, make sure to edit the script first.' sys.exit() main()
а для того, чтобы диск не исчезал бесследно после ухода в standby-режим можно использовать программу SleepWatcher, написав для нее элементарное правило:
#!/bin/sh if [ ! -d "/Volumes/RAMDisk" ]; then /Path/to/the/aforementioned/script fi
-
предпочитаю Chromium в силу того, что он не соджержит закрытого кода Google. можно так же посмотреть в сторону SRWare Iron, хоть там все и не так однозначно. ↩
-
да, python совершенно бесповоротно очаровал меня исключительнейшей простой и логичностью. ↩
-
например, это может быть
PNaClTranslationCache
, или расположенные в~/Library/Application Support/Chromium/Default/
каталогиExtension State
иExtension Rules
. или что-то еще. ↩