Skip to content

Instantly share code, notes, and snippets.

View matthewpalmer's full-sized avatar

Matthew Palmer matthewpalmer

View GitHub Profile
@matthewpalmer
matthewpalmer / gist:7836328
Created December 7, 2013 01:49
Automatically post to tumblr from iA Writer
# The file we are using is the frontmost one in iA Writer
# Returns the location of the file
set the_file to get file of front document of application "iA Writer"
# Get the contents of the file
set the_initial_text to (do shell script "cat " & quoted form of (POSIX path of the_file))
# Set the title to the filename
set the_title to get name of front document of application "iA Writer"
@matthewpalmer
matthewpalmer / gist:7836424
Last active December 30, 2015 13:29
New linked post for tumblr in ia writer
on displayErrorMessage(s)
display dialog (s) buttons {"OK"} default button "OK" with icon caution
end displayErrorMessage
tell application "Safari"
try
# Get the URL, title and selected text of the frontmost page
set pageURL to URL of document 1
set pageTitle to name of document 1
set selectedText to (do JavaScript "(''+getSelection())" in document 1)
@matthewpalmer
matthewpalmer / gist:7836472
Created December 7, 2013 02:05
full auto linked tumblr post ia writer
on displayErrorMessage(s)
display dialog (s) buttons {"OK"} default button "OK" with icon caution
end displayErrorMessage
tell application "Safari"
try
# Get the URL, title and selected text of the frontmost page
set pageURL to URL of document 1
set pageTitle to name of document 1
set selectedText to (do JavaScript "(''+getSelection())" in document 1)
@matthewpalmer
matthewpalmer / gist:9046522
Created February 17, 2014 07:57
socket hang up
info: Welcome to Nodejitsu _matthewpalmer
info: jitsu v0.13.9, node v0.10.21
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
info: Analyzing application dependencies in node app.js
info: Checking app availability wildfire
info: Creating app wildfire
error: Error creating wildfire
error: socket hang up
error: Error running command deploy
//
// main.c
// memory
//
// Created by Richard Buckland on 20/11/12.
//
#include <stdio.h>
#include <stdlib.h>
#include <float.h>
//
// main.c
// memory
//
// Created by Richard Buckland on 20/11/12.
//
#include <stdio.h>
#include <stdlib.h>
#include <float.h>
// Get the index in the array of the header
static int indexOfHeader(free_header_t *header) {
int index = (int) ((void *)header - (void *)memory);
return index;
}
-f
Deallocating memory at 0x7fe751801e10
Our index is 3072
Start header is 0
0x7fe751801200 index: 0 size: 2048 next: 2048 prev: 4032 magic: deadbeef
Entering the loop
Finished the loop
The first header after 0x7fe751801e00 index: 3072 size: 256 next: 3840 prev: 3968 magic: deadbeef
is 0x7fe751801200 index: 0 size: 2048 next: 2048 prev: 4032 magic: deadbeef
@matthewpalmer
matthewpalmer / results
Created September 3, 2014 08:47
Sort investigation
# Sort A
```
Testing: ./sortA
Input size: 10
R: 0.00 seconds
A: 0.00 seconds
D: 0.00 seconds
Input size: 20
R: 0.00 seconds
#!/usr/bin/perl -w
$start = 10;
$end = 100000;
$alg = "./sortA";
$tmp = "tmp1";
@types = ("R", "A", "D");
$start = 10;
print "Testing: $alg ";