codeswitcher: A rainbow splash of paint exploding upward (Default)
[personal profile] codeswitcher
OMGOMGOMG, I just discovered javascript's Function.prototype.toString() method.


function foo (
  alert ( "Hello, World!" );

alert ( foo.toString ); 
... causes an alert pop-up to display with a text of function foo \n(\t alert ( "Hello, World!" );\n} (only with all those tabs and returns rendered correctly).

I think I am hyperventilating.

I am going to get in so much trouble with this.

Once I stop cackling maniacally and dancing around the house in ecstacy.
codeswitcher: A rainbow splash of paint exploding upward (Default)
[personal profile] codeswitcher
Huh. I was creating a new shared folder on my NAS through its web interface, clicked on the wrong thing, and discovered its drive is pretty close to full.

Well, I figure I've been putting a lot of backups on it. Maybe the pruner for that or the log rotater isn't doing what it should? But no, those are fine.

Then, poking around, I accidentally discovered that in the shared folders directory (/mnt/disk/volume1), there's a file called "backing_file", which is 400G. It's binary, and hasn't been updated since Apr 17 2013.


I'm trying to decide if I can delete it or not. It's not impossible I created it by mistake, back when I was setting up my backup system, but I don't know how. Google's only apparent association with that string and Debian is for a utility, qemu-img, which I'd never heard of. I've not messed around with disk images in years and years, and never on that device.


Apr. 8th, 2017 03:48 pm
codeswitcher: A rainbow splash of paint exploding upward (Default)
[personal profile] codeswitcher
WTELF. I am trying to – yes, yes, I know – do regexes on dumps of the LJ Inbox, and I just discovered that something Very Weird is going on with the linefeeds.

Mostly everything is fine. Except the part that isn't: The actual message contents seem to have line breaks between, er, lines (at least everything that renders that thinks they're line ends – View Source in Firefox, more at the command line, BBEdit) except that perl isn't seeing them as line breaks. Perl thinks (okay, while (my $line = <INBOXFILE>) returns) they're all one big happy line with some sort of line break in them. Running against that string regex that matches just the HTML at the end ($line =~ /<div class=\'actions\'>/) doesn't just return the last line of the message, it returns almost the whole damned message.

To confirm this, I wrote a perl script to simply number the lines of the raw HTML. It returned something like the following (heavily redacted because privacy and not escaping all the damned angle brackets):

522:                 <td class="item">

523:                     <div class="InboxItem_Controls"><a href=''><img src='../../' width='16' height='18' class='InboxItem_Bookmark' border='0' /></a> 

524:                 <a href=""><img src="../../" class="InboxItem_Expand" border="0" onclick="return false" /></a>

525:                 </div>

526:                     <span class="InboxItem_Title InboxItem_Unread" id="all_Title_3320"><div class='pkg'><div style='width: 60px; float: left;'><img src="../../" width="50" align="top" /></div><div>Re: (no subject)<br />from HTMLHTMLHTML...


528:                 <div class="InboxItem_Content" style="display: block;">Yes, exactly that one!  Thank you so much.  blah blah blah it's an awesome post, and I'm so glad you helped me find it again.
<br />
<br />randomusername
<br />
<br />--- I wrote:
<br />> This one? URLgoeshere
<br />> <br />> --- randomuername wrote:
<br />> > Sorry for bothering you, but was it you that wrote the awesome post about the blah blah blah?  I can't find it despite googling a lot, so I thought I'd ask... <div class='actions'> <a href=''>Reply</a> | <a href=''>Add as friend</a> | <a href='' class='mark-spam'>Mark as Spam</a></div></div>


530:                     </td>


What I think should happen is that only the "line" that starts <br />> > Sorry for bothering you etc should be returned by matching on the attribute of that tag at the end. What I'm getting is everything here marked 528 and in bold.

As always, the questions are:

1) Why is it doing this to me? (Is there something actually different about those linefeeds? My text editor seems to think they're identical.)
2) What is doing this to me? (Is this perl being weird?)
3) How do I make it stop? (Can I convince perl not to do what it's doing and do something that make more sense?)

Advice welcome. Meanwhile, I'm necessarily just going to live with it. Don't have time to wrestle this alligator on my way across the swamp.
codeswitcher: A rainbow splash of paint exploding upward (Default)
[personal profile] codeswitcher
Does two things:

1) Removes the ToS modal overlay.

2) Unfolds all Inbox messages.

// ==UserScript==
// @name        Codeswitcher's LJ ToS-Boss
// @namespace
// @description FU SUP
// @include     http://**
// @include     http://*
// @version     2
// @grant       none
// ==/UserScript==

window.onload = function () {
  document.body.setAttribute("class","s-horizon logged-in");   
  var hackthisStylesheet = document.styleSheets[document.styleSheets.length - 1 ];
  hackthisStylesheet.insertRule(".InboxItem_Content { display: block !important; }", 0); 
codeswitcher: A rainbow splash of paint exploding upward (Default)
[personal profile] codeswitcher
So, I just discovered you can replace (I mean manually) the href="javascript:void(0);" in the a tags with actual GET strings to, e.g. Twitter's sharing doohicky, HOWEVER,


Is fine,programming

instead triggers LJ's javascript pop-up sharing thingy, for no obvious reason, and does not actually follow that link on clicking.

Does the javascript thing, too.

Huh. The trigger seems to be the word "hashtags"? How bizarre.

Fortunately, that's an undesirable feature anyway, so good riddance.
codeswitcher: A rainbow splash of paint exploding upward (Default)
[personal profile] codeswitcher
I wrote some scripts to automate the granting of access filter privileges in Dreamwidth, for recent importees from Livejournal.

They're in perl, and use wget, and are for the command line, and require that you figure out how to come up with a cookie file.

Instructions in the

They are here on Github.

There are many improvements that could be made, but I think I should move on to trying to address some of the other outstanding importation problems.

I so clearly have no idea how to use github. Suggestions of every sort are welcome, including just which license I should release this under.
codeswitcher: A rainbow splash of paint exploding upward (Default)
[personal profile] codeswitcher
Maybe could be used as a repository for images for LJ refugees. They give 3G of storage for free account. It doesn't, of course, honor LJ's permissions schemes. A question arises how exposed individual images are by URL. Can the existence of images be derived from other evidence?

The best solution may be to have different accounts (!) for different permissions levels. has an API:

It allows for upload of images (media!) and editing metadata.

Uses OAuth2, has to be a registered application.

(This ask on Stackoverflow is what twigged me to the existence of the (as opposed to API.)
codeswitcher: A rainbow splash of paint exploding upward (Default)
[personal profile] codeswitcher
h/t to [personal profile] antennapedia on LJ, "Making a local archive with wget"

You can use wget (if you have wget) to fetch pages off LJ and DW that you can only access logged in by this handy method:

1) Install the "Export Cookies" add-in to FireFox (presumably there are ways to pull this off with other browsers, but this is what I did.)

2) Log in to LJ or DW as appropriate.

3) Run "Export Cookies" and put the resultant cookie file somewhere you can find it.

4) Call wget like so:
wget --cookies=on --keep-session-cookies --save-cookies /path/to/newcookie.txt --load-cookies /path/to/ff_exported_cookes.txt --header "X-LJ-Auth: cookie"
substituting whatever url you want for "".

On DW, the "X-LJ-Auth" header field name still works, as does "X-DW-Auth".
codeswitcher: A rainbow splash of paint exploding upward (Default)
[personal profile] codeswitcher
github's repository name randomizer just proposed my new repository be named "didactic-winner".

Maybe not.
[identity profile]
Did you ever wonder whatever happened to the Daughter of Bilitis?

It was destroyed when a disgruntled member/volunteer stole the sole copy of the list of members. Bam! End of organization.

Mailman is a popular list server with a web-based self-service interface for users. It has many fine features, none of which are a way to back up your actual membership list (to say nothing of your archives and config files) from the web interface.

Since the vast majority of Mailman list owners/moderators are apparently customers running their lists on Mailman servers operated by web hosting companies for their customers, the vast majority of Mailman list owners/moderators do not have command-line access to the Mailman install running their list and they have no way to back up their data, save asking their hosting company to do that for them (manually!)...

Or this.

The one thing you can back up is the list of email addresses of a list and the associated personal names, and the one way to do it is through the email interface.

Manually, this is simple enough. Email [$listname]-request@domain.tld with "who $adminpassword" in the body of the message. The list will be emailed back to whatever address you sent it from. Lovely.

What follows is a description of my automated system for firing off such an email every night, using nmh, procmail, and cron.

cut for length )
[identity profile]
Enabling plus addressing in Cpanel should be easy, what with all the layers of email filtering it presents the domain owner. The way to enable plus addressing is to filter incoming email on the basis of to whom its addressed. If you're fred@domain.tld, and want plus addressing to work, all forms of fred+arbitrarystring@domain.tld need to get routed to fred@domain.tld. That's a job for email filtering.

Alas, Cpanel presents the user with no way to filter incoming email on the basis of who it's really addressed for, i.e. the recipient specified in the envelope of the message. This is the address you really want for filtering, because without it, BCC and email list messages aren't delivered when you try to filter on the recipient. To add insult to injury, a "Envelope-to" field is added to messages at delivery -- after all filtering is done.

Cpanel is exim under the hood, and, frankly, the best thing about cpanel+exim is that it allows you to call out to some other real filtering program, if available.

And procmail, which is such a real filtering program, is on many linuxes by default. And it, in turn, can call perl so you can really get something accomplished.

So the answer to "How can I filter by the Envelope-To in cpanel+exim?" is "You can't. But you can call something that can."

Instructions. Cut for epic length. )
[identity profile]
1) What are the per-user maximums for:

a) Number of grantees?
b) Number of filters?
c) Number of tags?
d) Char length of usernames?
e) Char length of tags?

2) What are the three levels of NSFWness or whatever that feature does, "anything (show all content)", "safe or non-explicit", and "safe for work only"? Wait, is this the same thing as "Age Restrictions"? (I think I may be about to get offended. Is there controversy about this?)
a) Does it map to a setting per journal or per comment?
b) "Ratings" right? Is there a ratings icon? (Otherwise I'll just use the letter "R".)
c) Is there some abbreviated version of those lengthy descriptions? I need some concision in this interface.
d) There is no "NSFW only" option? Nobody wants porn filters?

3) "AND" tag subscriptions? Really? Are there people using this? Because it adds a lot of difficulty (to say nothing of confusing the poor end users) for what I suspect is not going to be a popular feature. I'm ready to be wrong, of course. But it would be great if we didn't have to support this.

4) I'm contemplating the extant filter management tool, and a current limitation is that you cannot subscribe to different tags at different Ratings levels for the same person. So, if you want to sub to Rhonda's snarry and wincest filters, but: (1) her snarry stuff is really explicit -- NSFW -- but it's no problem for you because it's pretty 'nilla, while (2) her roy/roy alternates between really dark h/c but not always, and you don't want to read the torture but do want to tune in when it's not triggery. So you want to sub to rhonda:snarry:all but rhonda:roy/roy:safeforworkonly.

The interface approach I'm thinking of would support doing this, kinda by accident. However, will the back end? Because if the back end won't support that, then I should do something to add that constraint to the front end.

Put another way: the Rating filter seems to modify the user, not the tags.

Which is a round-about way to say, I think I'd better have some idea how subscriptions are represented in the db. I was imagining a three-column hash table, user_id/tag_id/rating_id. Except maybe I'm imaging user_id/[array of tag_ids]/rating_id to handle the "AND" case. But in any event, with all three foreign key fields being many-to-many. Which on further contemplation is not what's happening?

5) What characters are not allowed in tags and might be used as delimiters?
[identity profile]
[ profile] foxfirefey posted elsewhere:
So, the main bug for improving the filter management interface is this:

* Improve UI for Filter Management

Other bugs that will influence the controls of the revamp, I think, are

* Export of access (or subscription) filter lists
* Link to per-user access/subscribe filter changing on the filter page
* Inverse reading filters on the fly
* New filters from old
* import names from access filter to subscription filter
* Add a "locked" option to subscription filters
* Add more options to ratings on subscription filters
* Subscribe to tag from /manage/circle/add or manage/circle/edit -- modularity so we could put an interface on these pages easily is a great plus

This does not have to be part of the same interface but if we are capable of doing this so much the better:

manage/subscriptions/filters should not require JavaScript

So, what we need to do overall:

* Probably make mockups, even simple ones, of what different stages/actions on the interface do, and where they are
* Backend is Perl and Template Toolkit; frontend can be HTML5 with CSS and jQuery/jQuery-UI. We're trying to kill all the BML (about 45k lines to go of mashed up Perl, JS, CSS, and HTML)

I think actually implementing all of this is pretty heavy hitting stuff and way out of the scope of one development project, but UI/UX mockups and functional specifications to start from and feedback during implementation would be great.

I looked over on DW and you had a free account, which would be very inconvenient for seeing what extra subscription filtering options there are right now, so I've gotten you a paid account for a while.

Other incidental bugs for reading filters, just so you know what's also on the table:

* Subscription Filters: create a module to display them as links -- this will let people use a list of their filters in the modules areas. Pretty easy, I think I could do this one right after my other bug goes through, I've done modules before.
* Optionally allow readers to see the other members of a custom filter
* Improve filter error message -- now that we can have public filters, an improvement to the error page is timely, since we could list public filters and provide a login.
* console command to output membership in a custom filter
[identity profile]
LJFilterRescue is a Greasemonkey userscript. LJFilterRescue is available for download on

What it does

Lists your fgroups (filters) and their members at the bottom of your "Manage Custom Friends Group" page in text for ease of cutting-and-pasting.


You back up your journal, right? Do you back up your filters? If LJ were down indefinitely, would you know who you put on which filter, so you could reconstitute your filters somewhere else?

Because LJs only filter management tools are form controls, there's no way to get a simple textual list of your filters and who's in 'em. Until now.


The Greasemonkey add-on for Firefox.
This userscript.
Page generated Apr. 19th, 2019 02:33 am
Powered by Dreamwidth Studios