Archive for the ‘Crap’ Category
Convert adblock rule list to regular expressions
#!/bin/sh
ADLIST=”http://adblock-chinalist.googlecode.com/svn/trunk/adblock.txt http://easylist.adblockplus.org/easylist.txt”
echo -n > /tmp/adblock.txt
for URL in $ADLIST
do
echo Fetching $URL …
curl $URL | grep -v ^$ | grep -v # | grep -v ^[!|@] | grep -v \$ | sed ’s/./\./g’ | sed s/*/.*/g | sed ’s/|/\|/g’ | grep -v ‘Adblock Plus 1′ >> /tmp/adblock.txt
done
Note this will generate >1000 regexp lines, which might impact performance of your web browser.
Idle reminder script for The Hit List
This handy script will remind(disturb?) you every N minutes about what you are doing (if you begin a task in
The Hit List
) or you are idling right now as
Growl
notification.
Paste the following code to Script Editor, Save.
try
tell application "GrowlHelperApp" to register as application "THL Notifier" all notifications {"Doing", "Idle"} default notifications {"Doing", "Idle"} icon of application "The Hit List"
tell application "System Events"
tell process "The Hit List" to set myDoing to get value of text field 1 of window "Timer"
tell application "GrowlHelperApp" to notify with name "Doing" title (myDoing) description ("now doing...") application name "THL Notifier" priority 0 sticky no icon of application "The Hit List"
end tell
on error
tell application "GrowlHelperApp" to notify with name "Idle" title ("Something to do?") description ("idle...") application name "THL Notifier" priority 0 sticky no icon of application "The Hit List"
end try
Open Terminal, type
crontab -e
Add this line and save ( you can change 15 to what ever minutes between each reminder)
*/15 * * * * osascript /path/to/Whatsup.scpt
Note: due to the limitation of the time tracking window display in THL, this script does not support Spaces very well.
Install multiple versions of Flash plugin for Firefox
As developing ActionScript projects, one have to frequently switch between different Flash versions and test. Here is a tip for Mac OSX ( also works on Windows I think ) to install multiple versions of Flash Player plugins for Firefox.
When Firefox starts, it scans for plugins in 3 sets of directories:
- General plugin directory for current system and user, e.g.
/Library/Internet Plug-Ins/ - Plugin directory for current application executable file, e.g.
/Applications/Firefox.app/Contents/MacOS/plugins/ - Plugin directory for current profile, e.g.
~/Library/Application Support/Firefox/Profiles/fw9q5h64.default/plugins
Then it will
sort by modification time
, dedupe and load all the plugins.
Now you get the trick:
- Extract the desired firefox plugin files (
e.g. Flash Player.plugin
and
flashplayer.xpt
on Mac ) from Flash plugin installer or copy from installed directory ( e.g.
/Library/Internet Plug-Ins/
on Mac ) - Copy these files to your favorite firefox app or profile directory
- use the command
touch -t 201603150101.01Flash Player.plugin
flashplayer.xpt
to make the mtime larger than the one in the general directory.
- repeat above steps for all flash versions you want.
Update: you should check “Open using Rosetta” when playing Flash 8 or earlier with Firefox on Mac.
TextMate bundle for the haXe Language
URL Handler and Bookmarklet for The Hit List
This app will handle x-thl:// links and add task to your inbox of
The Hit List
.
The bookmarklet will use title of web page as title of the task and pick page url and selected text as notes.
THL URL Handler.app.zip
- unpack to Applications folder of your Mac
Send to THL
- Drag to bookmark bar of your favourite browser
If you’d like to write your own bookmarklet, here’s the template:
position
=optional
only inbox is supported at this stage,
i’ll consider if add support for start/due and specify a project in THL some time later.
Mar 25, 2009 - App updated!
Newly supports:
- optional position parameter ( beginning or end )
- inbox can be any project or even folder1/folder2/project
Enjoy!
Script Entourage messages to The Hit List
The Hit List
is a good task management software for Mac OSX, and I think it’s better than
OmniFocus
and
Things
.
120 then set theNotes to get text 1 through 120 of theNotes set theNotes to theNotes & "..." end if tell application "GrowlHelperApp" to notify with name "New Email" title (theTitle) description (theNotes) application name "Entourage Growl Notifier" priority 0 sticky no icon of application "The Hit List" end repeat end tell ]]>
To use this as a mail rule, in Entourage, open menuToolsRules, add a new rule with “Run AppleScript” as its action.
To use this as a menu item or hotkey script, copy the script to
/Documents/Microsoft User Data/Entourage Script Menu Items/
, it’ll appear in the Script menu of Entourage.You can even add a
cT
after it’s name so that it will be triggered when you press Ctrl-T.
Bulk edit in redmine-0.7.x
for those who stick to redmine-0.7, apply this to make its bulk-edit rework in Firefox/Safari.
backported from trunk.
Detect ActionScript 2/3 in TextMate
I made
a very rough tmplugin
(TM 1.x OSX 10.4+ UB) to search the word “package” in the beginning of first 20 lines of .as file to determine whether it’s AS3 or AS2, then select a proper bundle. It’s modified from
TabMate
.
You should have
ActionScript
and
ActionScript 3
tmbundle before install this tmplugin.
Growl notification for 1G1G.com
It’s a
Fluid
SSB user script.
// ==UserScript==
// @name 1G1G
// @namespace http://fluidapp.com
// @description Show Growl notification when song changes
// @include *
// @author freewizard gmail.com
// ==/UserScript==
(function () {
if (window.fluid) {
window.lastTitle = "亦歌-自由自在听音乐";
setInterval(function() {
if (document.title == window.lastTitle) return;
window.lastTitle = document.title;
window.fluid.showGrowlNotification({
title: "亦歌",
description: window.lastTitle,
identifier: "www.1G1G.com"
});
}, 1000);
}
})();
Quick filter by mail topic in Microsoft Entourage
Save the following AppleScript code as ~/Documents/Microsoft User Data/Entourage Script Menu Items/Quick FiltercF
on ltrim(someText)
repeat until first character of someText is not in {" ", tab, ASCII character 10, return, ASCII character 0}
set someText to text 2 thru -1 of someText
end repeat
return someText
end ltrim
on run
tell application "Microsoft Entourage"
--activate
set msgs to the current messages
if msgs is {} then return
repeat with msg in msgs
set subj to get the subject of msg
end repeat
set AppleScript's text item delimiters to {":"}
set tpc to last text item of subj
end tell
set tpc to my ltrim(tpc)
set the clipboard to tpc
tell application "System Events" to tell process "Entourage"
delay 0.1
keystroke tab
delay 0.1
keystroke "v" using command down
keystroke tab
end tell
end run
Make sure quick filter is turned on (Cmd-Shift-L);
Click one item in the messages list;
Click script menu and select our script.
