Skip to content

Instantly share code, notes, and snippets.

I see this error when I try to suspend an Ubuntu 10 guest in Fusion:

The request to Suspend this virtual machine failed because the corresponding VMware Tools script did not run successfully.

If you have configured a custom suspend script in this virtual machine, make sure that it contains no errors. Attempting the operation again will ignore the script failure. You can also submit a support request to report this issue.

As the dialog states, the second time you try to suspend the VM it ignores the non-zero return code of the script and it seems to work. But it's annoying.

The problem appears to not be VMware actually, but Ubuntu (or Ubuntu's service script). I tried to figure out where exactly Ubuntu's initctl configuration/scripts is broken to no avail but found a work-around that I'm happy with.

function isLeapYear(year) {
var result = false;
var yearVal = parseInt(year);
if (yearVal % 100 == 0) {
if (yearVal % 400 == 0) {
result = true;
}
} else {
if (yearVal % 4 == 0) {
result = true;
@xd547
xd547 / jquery_check_all.js
Created March 4, 2014 07:15
jQuery check all
$('#check_all').on('click', function() {
if ($(this).is(':checked')) {
$('input[id*="week"]').prop('checked', true);
} else {
$('input[id*="week"]').prop('checked', false);
}
});
$('input[id*="week"]').on('click', function() {
if ($('input:checked[id*="week"]').size() == $('input[id*="week"]').size()) {
@xd547
xd547 / gist:9641554
Created March 19, 2014 13:25
rails rspec controller json empty response.body
describe 'xxx' do
render_views
# ...
end
@xd547
xd547 / hello.go
Created March 19, 2014 13:53
Writing, building, installing, and testing Go code
# from https://www.youtube.com/watch?v=XCsL89YtqCs
mkdir gocode
export GOPATH=$HOME/gocode
cd gocode
mkdir -p src/github.com/xd547
mkdir hello
cd hello
# create hello.go
# see hello.go below
go install
# Xcode
.DS_Store
*/build/*
xcuserdata
*.xccheckout
#CocoaPods
Pods
defaults write com.apple.finder AppleShowAllFiles TRUE
defaults write com.apple.finder AppleShowAllFiles FALSE
@xd547
xd547 / <bundle-name>-Prefix.pch
Created July 16, 2014 08:02
Add CoreData header to pch
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#endif
#define MYLog( s, ... ) NSLog( @"\n<%p %@:(%d)>\n@@@ %@", self, [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] )
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Diagnostics;
namespace sort
{
class Program