Skip to content

Instantly share code, notes, and snippets.

View kragen's full-sized avatar

Kragen Javier Sitaker kragen

View GitHub Profile
@kragen
kragen / gist:69bafe7c98d70e3181c7
Created June 5, 2015 20:17
If an opinion doesn't touch the question of when violence is justifiable, it's not a political opinion.

I claimed, "If an opinion doesn't touch the question of when violence is justifiable, it's not a political opinion.". Brian Mastenbrook asked, "Doesn't this imply that there are no politics amongst anarchists?" As I understand it, the underpinning of this question is that anarchists do not accept or consider justifiable the kinds of state violence that everyone else considers not only justifiable but usually morally obligatory.

Leaving aside current deep philosophical differences among anarchists about the question of when non-state violence may or may not be justifiable, I think the discussions we normally characterize as political still, usually, boil down to questions of violence.

Of course, the most usual example of politics is entirely, 100%, about when violence is justifiable: it concerns either what policies the State is to enforce using its Westphalian monopoly on justifiable violence, or who will make that decision. Taking as an the example

Fuck. Firefox's history UI is so fucking bad that this is actually fucking better:

: user@debian:~; sqlite3 places.sqlite 
SQLite version 3.7.13 2012-06-11 02:05:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .mode column
sqlite> select title, url, visit_count, datetime(last_visit_date/1000000, 'unixepoch') from moz_places order by last_visit_date desc limit 100;

Disable or remove Add-ons | Firefox Help  https://support.mozilla.org/en-US/kb/disable-or-remove-add-ons  1            2015-04-27 22:27:25                           

How do I dynamically generate bytecode?

Aside from understanding the JVM bytecode (for which javap -c, javap -c -private, and chapter 6 of the JVM spec are helpful), there’s the question of how to get from a plan for code to generate to actually being able to run the code on the JVM, as described in [chapter 5][] of the JVM spec.

This is slightly munged jstack output from a .find() of a Java regular expression that looks like some initial stuff some stuff (\d+) some more stuff (foo|bar) some more sstuff (\d+) being matched against a logfile line of around 100 characters.

"main" prio=10 tid=0x0000000000f31800 nid=0x523e runnable [0x00007f7ece452000]
   java.lang.Thread.State: RUNNABLE
at java.util.regex.Pattern$Curly.match(Pattern.java:3761)
at java.util.regex.Pattern$GroupHead.match(Pattern.java:4185)
at java.util.regex.Pattern$Slice.match(Pattern.java:3499)
at java.util.regex.Pattern$GroupTail.match(Pattern.java:4244)
at java.util.regex.Pattern$BranchConn.match(Pattern.java:4095)
at java.util.regex.Pattern$Slice.match(Pattern.java:3499)

Henry Farrell said, of Aaron Swartz:

Maybe better way to put it was that he was intensely focused on his (and only his) understanding of right thing to do.

Now, of course a person could be less focused on the right thing to do. Many people, for example, are focused on what they want to do, or what others want them to do, without regard to whether or not it's right. Clearly this is a way Aaron was very different from the mainstream.

And if you're considering understandings of right and wrong in the abstract — perhaps because you're teaching a class in ethics — perhaps you could focus on other people's understandings of right and wrong. Perhaps you're strongly consequentialist (as Aaron was) but today you're leading your students through Kant. You'd better focus on deontological understandings of the right thing to do, or your students are going to be in trouble.

But if we're talking about focusing on understandings of the right thing to do

@kragen
kragen / README.md
Last active December 31, 2015 18:39 — forked from mbostock/.block

This page demonstrates a simple approximate algorithm for finding the closest point on any given SVG path element.

A coarse linear scan of the path provides an initial guess. Then, a binary search improves the guess to the desired level of precision (here, about 1px). To account for kinks in the path that can cause the binary scan to get stuck in a local minimum, the coarseness of the initial scan is dependent on the number of path segments. I doubt this algorithm is provably correct, but it seems to produce fairly good results even for the kinky path shown above. This technique is based on Mike Kamermans’ excellent Primer on Bézier Curves.

Knowing the closest path to a given point is useful for multi-line charts in the same way the Voronoi tessellation is useful for scatterplots: it makes it easier to select or highlight elements using the mouse. Instead of requiring the user to hover over a line

;; This pretty much works. A couple of remaining quibbles:
;;
;; - it’s possible for the region to not include a single Python
;; expression, in which case the code transformation will be
;; invalid.
;; - it should error out if called interactively when
;; transient-mark-mode is active and the mark is inactive, but it
;; doesn’t, because I don't know how to do that.
;; - it would be nice to highlight the other occurrences of the
;; expression, if any, and provide a key (maybe the same key?) to
<!-- --> <script>
// Euler problem 1, in APL semantics implemented in JS
// Count zero to n, not including n.
function iota(n) {
var rv = [];
for (var ii = 0; ii < n; ii++) rv.push(ii);
return aplify(rv);
}

Bathroom deodorants

The standard approach to bathroom deodorization — covering up the smell with a stronger smell — is a dead end. It will never work well, and it's noxious.

As a simple alternative, you could replace all the air in the bathroom with new air upon completion. The old air could be filtered to remove odors and other impurities. Clean-room-style airflow systems will run into certain difficulties with the toilet bowl, but a simple directed fan should solve the problem.

The average volume of air needed in an office environment might be 40 uses over an 8-hour day, but it's desirable that the air replacement be complete within a few seconds of the use of the bathroom. A minimal bathroom might be 1.5m x 3m x 2m, or 9 m^3, roughly 9kg of air, and three air changes might be needed to purify it entirely. That's 27 * 40 / 8 = 5 * 27 = 135 m^3 per hour of average filtration, or 38 liters per second, which I think will require a filter of a few square meters — perhaps comparable to the size of

<?php
function basic_bs_register_settings() {
register_setting('basic_bs_settings_group', 'basic_bs_settings');
}
add_action('admin_init', 'basic_bs_register_settings');
$basic_bs_options = get_option('basic_bs_settings');
function business_tools_admin_menu() {