Turning the Spindle On/Off on a Comet CNC

Comet CNC SpindleIt’s common for people to use a low-end spindle on a Probotix Comet CNC. The LinuxCNC software can turn the spindle on and off, but not control the speed or direction.

The G-code for turning a spindle on is M3,  but that command alone will not work. It needs a non-zero speed parameter. For example:

M3 S1

will turn the spindle on. To turn it off use M5.

M3 S1
…other commands…

As always, stay safe.


Posted in CNC & Robotics | Tagged , , , , , , , , , | Leave a comment

Resolving the git error “pack exceeds maximum allowed size” during push

Elephant_near_ndutuI have a large repository that takes up a modest number of gigabytes. When attempting to push it to a  new remote repository,  the push failed, complaining that the pack size exceeds the maximum allowed.

First of all, let’s get out of the way the fact that repacking the local repository or fiddling with the pack.packSizeLimit limit configuration setting won’t fix the problem. That will simply tidy  up your local machine.

As I understand it (corrections welcome), the problem is a collision of several things. When performing this massive beginning-to-end push, git creates a massive pack on  the fly and pipes that across the network to the remote machine. The remote machine needs  to be able to perform memory mapping on this huge wad of data. File system, CPU architecture, and memory needs have to be satisfied for this to work. Otherwise, the pack size error is reported and the push fails. Annoyingly, this can happen after you’ve transferred gigabytes of data across a network with a bottleneck, completely wasting a lot of time.

Fortunately the work-around is simple. Push the repository in chunks, working your way up the tree.

If your repository has a lot of branching, you may be able to push a branch at a time, as the generated pack will be for that branch.

This repo of mine has a very linear history, and feeling a little lazy I used my git GUI (SourceTree) to make a temporary branch about a third way up the tree, and pushed that. I moved the temporary branch another third of the way up the tree, and pushed that. Finally I could push master and remove the temporary branch.

If the repository were big and hairy enough one could write a script to traverse the tree and programmatically push at appropriate commit points, but for me it’s an exceptional situation that doesn’t warrant that type of effort.


Posted in SysAdmin | Tagged , , , , , , , | Leave a comment

Hacked By K3L0T3X

~!Hacked By K3L0T3X alias Le Bg!~

Hacked By K3L0T3X


Greetz : Prosox, RxR, General KBKB, Kuroi SH, Shade, Sxtz

\!/@ws_k3l0t3x https://twitter.com/ws_k3l0t3x ~Hacked By K3L0T3X\!/

Hacked By K3L0T3X! !

Posted in Programming | Tagged , , , | Leave a comment

Reverting File Changes With git

This is not obvious to those of us with lingering Subversion habits comprar viagra madrid. If you’ve edited a file and simply want to discard its changes (à la Subversion’s revert), use:

git checkout filename

If it so happens that your file name is the same as a branch, you’ll need to use:

git checkout -- filename

Use the Right Tool for the Job

You may be tempted to use git reset --hard, but that will reset all uncommitted changes. If you just want to undo the changes to a single file, that’s the wrong tool.


Posted in Computer, Programming | Tagged , , , , , | Leave a comment

Re-enabling Repeating Keys In Yosemite

When programming, I and millions like me like to keep my hands on the keyboard and minimize the number of times that I have to spend time going through the process of lifting my hand off the keyboard to reach for the mouse, do something with the mouse, and return the hand to the keyboard. Being able to perform all editing functions from the keyboard is very efficient.

Thus, if an environment supports something like vim emulation, I’m all over it.

After upgrading to Yosemite I found that navigating in my JetBrains IDEs vim was dead. Even though key repeating is set in the keyboard preferences, keys won’t repeat. Worse, letters that can take accents pop up a menu that then expects me to choose and accent, e.g.


Press and Hold Popup Menu

I recognize this as behaviour derived from iOS devices, and can sympathize with non-programmers scratching their head asking, “Why would anybody want keys to repeat? There are no words that contain kkkkkkkkkkkkkkkkkkkkk.” But, they are not programmers using keyboard navigation.

To disable this behaviour, enter the following command in a terminal.

defaults write -g ApplePressAndHoldEnabled -bool false

You’ll need to restart your programs to pick up this new default behaviour, however.

Apparently this new behaviour appeared in Lion, but with Yosemite is seems to be a default forced on everybody.

Posted in Mac | 31 Comments

Updating Array Elements in CoffeeScript Loops

Notes on updating array elements in CoffeeScript loops.

CoffeeScript doesn’t use the JavaScript C-style for(;;) loops. When one wishes to conditionally modify the array that’s being iterated over, how one might go about it may not be obvious at first.

If I wish to update an array without otherwise disturbing it, the “obvious” answer will not work:

shouldUpdate = (colour) ->
    .... details ....

colours = ['red', 'green', 'blue']
for colour in colours
    colour = "foo" if shouldUpdate(colour)

This is because the compiler produces code like:

for (_i = 0, _len = colours.length; _i < _len; _i++) {
  colour = colours[_i];
  if (shouldUpdate(colour)) {
    colour = "foo";

Note that in line 2 the value in colours[_i] is copied to a separate variable colour, thus assigning to colour will not affect the array itself.

If we wish to modify the array in place, then we can tell CoffeeScript to provide us with the index thus:

shouldUpdate = (colour) ->
    .... details ....

colours = ['red', 'green', 'blue']
for colour, index in colours
    colours[index] = "foo" if shouldUpdate(colour)

There may be a slicker way to do this, but for now it suits my purposes.


Posted in Programming | Tagged , , , , , , , | 2 Comments

Maximize a Window in OS X 10.10 (Yosemite)

One of the changes in Yosemite is that the green maximize button on windows no longer maximizes, but puts the window into full screen mode. For how I work, this is a productivity killer. I don’t see any setting to revert this behaviour. However there is a workaround.

Hold down the Option key when clicking on a window’s green button to maximize. This will take a little time to build a new habit.


Apparently one can also double-click the window’s title bar, which I’m quite happy to see.



Posted in Mac | Tagged , , , , , | Leave a comment