Skip to content

Instantly share code, notes, and snippets.

@gnachman
gnachman / gist:1ec345a702be99497d51
Created April 28, 2015 17:25
Trivial google code project that does not import
{
"kind" : "projecthosting#user",
"id" : "@VRdVRFRUBRFGXgB6",
"projects" : [ {
"kind" : "projecthosting#project",
"name" : "testprojectgn",
"externalId" : "testprojectgn",
"htmlLink" : "/p/testprojectgn/",
"summary" : "teswt",
"description" : "test",
@gnachman
gnachman / gist:765a64ff1ba4cc5bc42a
Last active August 29, 2015 14:26
How to collect detailed memory usage info for iTerm2
First, install XCode from the app store. It takes a while to download so be patient.
At the command prompt:
git clone https://github.com/gnachman/iTerm2.git
cd iTerm2
open iTerm2.xcodeproj
XCode will open. Do this:
Long click on the "play" right arrow button in the top left of XCode
@gnachman
gnachman / gist:2560519
Created April 30, 2012 18:02
Extra debugging for iTerm2's fitWindowToTabSize
- (BOOL)fitWindowToTabSize:(NSSize)tabSize
{
PtyLog(@"fitWindowToTabSize %@", [NSValue valueWithSize:tabSize]);
if ([self anyFullScreen]) {
[self fitTabsToWindow];
return NO;
}
// Set the window size to be large enough to encompass that tab plus its decorations.
NSSize decorationSize = [self windowDecorationSize];
NSSize winSize = tabSize;
@gnachman
gnachman / swizzle-retain-release-autorelease
Created December 8, 2012 07:56
Swizzle retain/release/autorelease to debug busted reference counting
// Use with https://github.com/rentzsch/jrswizzle
// MIT license
// After your program dies because with a zombie, examine [theBigLog objectForKey:@"0x12345"], subbing the address of the thing that died. You can get stack traces referred to in the logs by looking up the "stack-12345" numbers in the same dict. To track a particular object, add [NSValue valueWithPointer:myobject] to debugList in a @synchronized block.
@interface ClassToDebug : NSColor
@end
@interface ClassToDebug (DebugRefs)
@end
@gnachman
gnachman / gist:6012401
Last active December 19, 2015 20:19
Dump of line block when cache is updated incorrectly after dropping lines
2013-07-16 13:26:48.122 iTerm[63794:303] Line block after dropping:
<0x1017e8aa0>
Already-dropped bytes: 2264
Start offset: 2264
is_partial: NO
Number of raw lines: 7
Cached lines: 119 at width 50
WRAPPED LINES:
Wrapped line 0: ff4e [DWC_RIGHT] 7a 72 20 6c ff45 [DWC_RIGHT] 20 20 6f 6c 70 ff49 [DWC_RIGHT] 72 ff45 [DWC_RIGHT] ff4e [DWC_RIGHT] 76 78 20 ff49 [DWC_RIGHT] ff47 [DWC_RIGHT] 6d 76 2c 20 61 75 67 6a 6a 62 ff45 [DWC_RIGHT] ff41 [DWC_RIGHT] ff55 [DWC_RIGHT] 20 20 72 67 70 ff4e [DWC_RIGHT] [EOL]
@gnachman
gnachman / gist:6180913
Created August 8, 2013 02:25
set rect dirty
- (void)setRectDirtyFromX:(int)fromX Y:(int)fromY toX:(int)toX Y:(int)toY
{
assert(fromX >= 0);
assert(fromX < WIDTH);
assert(toX >= 0);
assert(toX <= WIDTH); // <= because not inclusive of toX.
assert(fromY >= 0);
assert(fromY < HEIGHT);
assert(toY >= 0);
assert(toY < HEIGHT);
<key>LoadPrefsFromCustomFolder</key>
<true/>
<key>PrefsCustomFolder</key>
<string>path to folder with com.googlecode.iterm2.plist file, or URL of plist file</string>
diff --git a/sources/iTermProfilePreferences.m b/sources/iTermProfilePreferences.m
index 2561f5b..a74debb 100644
--- a/sources/iTermProfilePreferences.m
+++ b/sources/iTermProfilePreferences.m
@@ -12,6 +12,8 @@
#import "NSColor+iTerm.h"
#import "PreferencePanel.h"
+#define BLOCK(x) [[^id() { return [self x]; } copy] autorelease]
+
1455924832.332243 PTYTextView.m:1900 (-[PTYTextView mouseDown:]): Mouse Down on <PTYTextView: 0x7fdc6020a620 frame=NSRect: {{0, 2}, {1096, 952538}} visibleRect=NSRect: {{0, 951538}, {1096, 1000}} dataSource=<VT100Screen: 0x7fdc602068f0 grid:<VT100Grid: 0x7fdc60206a40 size=181 x 83, cursor @ (31,81)>> window=<PTYWindow: 0x7fdc5b544a20 frame=NSRect: {{680, 0}, {1112, 1045}} title=1. manprsi2@vm51bsd0154.qap (ssh) alpha=1.000000 isMain=1 isKey=1 isVisible=1 delegate=0x7fdc5b42c530>> with event NSEvent: type=LMouseDown loc=(224.355,750.559) time=730586.2 flags=0x100 win=0x7fdc5b544a20 winNum=16933 ctxt=0x0 evNum=26468 click=1 buttonNumber=0 pressure=1 deviceID:0x300000014400000 subtype=NSTouchEventSubtype, num touches=0
1455924832.332255 PTYTextView.m:1943 (-[PTYTextView mouseDownImpl:]): mouseDownImpl: called
1455924832.332269 PTYTextView.m:1979 (-[PTYTextView mouseDownImpl:]): mouseDownImpl - set mouseDownIsThreeFingerClick=NO
1455924832.332291 PTYTextView.m:2042 (-[PTYTextView mouseDownImpl:]): Set mouseDown=Y