Skip to content

Instantly share code, notes, and snippets.

@kennethkalmer
kennethkalmer / grep-postfix-message-ids-osx.sh
Created October 23, 2008 13:41
Grep for a pattern through a Postfix mail log, collect the message ids into a temporary file and then grep for all occurrences of the ID's in the maillog.
#!/bin/sh
# OSX friendly version by jeff donovan
#
# Grep for a pattern through a Postfix mail log, collect the message ids into a temporary
# file and then grep for all occurrences of the ID's in the maillog.
# This is a very intensive operation since it requires 1+N greps through the entire log file,
# where N is the number of unique ID's returned from the first grep.
#
# Usage sample:
//
// UIWebView+SmartJS.h
//
// Created by Jon Olson on 12/27/08.
// Copyright 2008-2009 Ballistic Pigeon, LLC. All rights reserved.
//
#import <Foundation/Foundation.h>
extern NSString * const SmartJSErrorDomain;
//
// NSObject+BlockObservation.h
// Version 1.0
//
// Andy Matuschak
// andy@andymatuschak.org
// Public domain because I love you. Let me know how you use it.
//
#import <Cocoa/Cocoa.h>
//
// UIWebView+awesomeness.h
// TWToolkit
//
// Created by Sam Soffes on 6/22/09.
// Copyright 2009 Tasteful Works, Inc. All rights reserved.
//
@interface UIWebView (awesomeness)
//
// CocosiPadAppDelegate.m
// Cocos.iPad
//
// Created by Marc Lee on 19/04/10.
// jTribe Holdings Pty Ltd & Adviso Technologies 2010
//
#import "CocosiPadAppDelegate.h"
#import "cocos2d.h"
@preble
preble / BNRBlockView.h
Created June 29, 2010 00:02
BNRBlockView: Add custom-drawn views to the Cocoa view hierarchy without subclassing.
@class BNRBlockView;
typedef void(^BNRBlockViewDrawer)(BNRBlockView *view, NSRect dirtyRect);
@interface BNRBlockView : NSView {
BNRBlockViewDrawer drawBlock;
BOOL opaque;
}
+ (BNRBlockView *)viewWithFrame:(NSRect)frame
@digerata
digerata / RoundedRectLabel.h
Created July 30, 2010 16:12
Create a UILabel with a rounded rect background like in the iPhone Mail app. (Much faster than using UILabel.layer.cornerRadius)
//
// RoundedRectLabel.h
//
#import <UIKit/UIKit.h>
@interface CountLabel : UILabel {
NSInteger cornerRadius;
UIColor *rectColor;
}
@soffes
soffes / install.markdown
Last active June 9, 2025 07:18
New computer setup

New Machine

Updated this for the first time in awhile in late 2020.

System Preferences

  • Enable iCloud
  • Disable iCloud mail
  • Display to medium
  • Turn up trackpad speed
@nz
nz / Delete all documents in a Solr index using curl.md
Last active January 27, 2026 19:05
Delete all documents in a Solr index using curl
# http://wiki.apache.org/solr/FAQ#How_can_I_delete_all_documents_from_my_index.3F
# http://wiki.apache.org/solr/UpdateXmlMessages#Updating_a_Data_Record_via_curl

curl "http://index.websolr.com/solr/a0b1c2d3/update?commit=true" -H "Content-Type: text/xml" --data-binary '<delete><query>*:*</query></delete>'

I'm amused at the traction this little gist is getting on Google! I would be remiss not to point out that six+ years later I'm still helping thousands of companies on a daily basis with their search index management, by providing managed Solr as a service over at Websolr, and hosted Elasticsearch at Bonsai. Check us out if you'd like an expert helping hand at Solr and Elasticsearch hosting, ops and support!

@marshluca
marshluca / round_corner_on_webview
Created January 6, 2011 05:23
Rounded Corners on UIWebview
// This is required in order to access the CALayer properties
#import <QuartzCore/QuartzCore.h>
// Create UIWebview
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(5, 20, 310, 220)];
// Round corners using CALayer property
[[webView layer] setCornerRadius:10];
[webView setClipsToBounds:YES];