This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
# About | |
# | |
# This program tries to fix Adobe's issues with case-sensitive volumes by | |
# using DTrace to log which files cannot be opened and then trying to | |
# generate a shell script which will rename the files to the names as | |
# Adobe wants them. | |
# | |
# USAGE: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
require 'fileutils.rb' | |
$home=ENV['HOME'] | |
$documents="#{$home}/Documents" | |
$already_tried_index="#{$documents}/already_tried_files.txt" | |
def does_pdf_file_contain_text?(fn) | |
text=`pdftotext #{fn.inspect} /dev/stdout` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
require 'tmpdir' | |
def fixed?(fn) fn =~ /\.searchable\.pdf/; end | |
def searchable_fn(fn) | |
return fn if fixed?(fn) | |
"#{File.dirname(fn)}/#{File.basename(fn, File.extname(fn))}.searchable.pdf" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* free.c - show free memory on OS X | |
* The api query code was extraced from Apple's vm_stat.c | |
* To compile: gcc -o free free.c | |
* Output: <byte count> <human readable bytecount> | |
*/ | |
#include <stddef.h> | |
#include <stdlib.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
# autosshscreen | |
# Simple autossh + screen | |
# USAGE: autosshscreen <SSH_OPTIONS> <user@host> | |
# | |
# Calculates the autossh ECHO port automatically for you (random number) | |
# and executes 'screen -x' on the host | |
# | |
# EXAMPLES | |
# autosshscreen name@host |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
i = Import["http://i.stack.imgur.com/Ta5wf.png"] | |
ws = WatershedComponents[i]; | |
ColorCombine[{Image[ws, "Bit"], i, i}] | |
ImageTake[i, Sequence @@ Reverse@Transpose@Last[#]] & /@ ComponentMeasurements[ws, "BoundingBox"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// calculate time left if we're more than 10% done | |
NSString *timeString = nil; | |
float percentLeft = (float)([theCanvas eventCount]-[theCanvas currentPlaybackEvent])/(float)[theCanvas eventCount]; | |
NSTimeInterval now = [NSDate timeIntervalSinceReferenceDate]; | |
if( percentLeft < 0.9f && now-_lastTimeWeEstimated > 5.0 ) { | |
_lastTimeWeEstimated = now; | |
NSTimeInterval timeLeft = (now-_exportStartTime)*(percentLeft/(1.0f-percentLeft)); | |
int hours = timeLeft/(60.0*60.0); | |
timeLeft -= (double)hours*60.0*60.0; | |
int mins = timeLeft/60.0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
constexpr uchar I_REX_B_41 = 0x41; | |
constexpr uchar I_REX_W_48 = 0x48; | |
constexpr uchar I_REX_WXB_4b = 0x4b; | |
constexpr uchar I_REX_WRXB_4f = 0x4f; | |
// INTEL: Opcodes | |
constexpr uchar I_PUSH_BP_55 = 0x55; | |
constexpr uchar I_LEA_8d = 0x8d; | |
constexpr uchar I_MOV_r8_rm8_8a = 0x8a; | |
constexpr uchar I_MOV_r64_r64_8b = 0x8b; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$pushed = [] | |
def push(*args) $pushed = args; args.map {|r| "push #{r}" } end | |
def pop_pushed; $pushed.reverse.map {|r| "pop #{r}" } end | |
puts DATA.read.gsub(/^\s*jmp\s*[^\n]*/, '%error "Dijkstra said: No!"').gsub(/=([^\n]*)/) {|c| (eval $1).join("\n ") } | |
__END__ | |
BITS 64 | |
section .text | |
global math |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| | |
| boot.s | |
| | |
| boot.s is loaded at 0x7c00 by the bios-startup routines, and moves itself | |
| out of the way to address 0x90000, and jumps there. | |
| | |
| It then loads the system at 0x10000, using BIOS interrupts. Thereafter | |
| it disables all interrupts, moves the system down to 0x0000, changes | |
| to protected mode, and calls the start of system. System then must | |
| RE-initialize the protected mode in it's own tables, and enable |
OlderNewer