Skip to content

Instantly share code, notes, and snippets.

View niw's full-sized avatar
🐱
Meow

Yoshimasa Niwa niw

🐱
Meow
View GitHub Profile
#!/bin/sh
PREFIX=/path/to/prefix
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin
# configure for iPhone device
mkdir -p build_for_armv6
pushd build_for_armv6
../configure --prefix=${PREFIX} \
--host=arm-apple-darwin \
--enable-static \
@niw
niw / gist:168338
Created August 15, 2009 12:20
A bookmarklet for iPhone which improve a view of any website on MobileSafari
<html>
<body>
<p>Drag next link to Bookmark then sync with iPhone.</p>
<a href="javascript:(function(){var%20m=document.createElement(%22meta%22);m.setAttribute(%22name%22,%22viewport%22);m.setAttribute(%22content%22,%22width=device-width%22);document.getElementsByTagName(%22head%22)[0].appendChild(m);})();">Set Viewport</a>
</body>
</html>
--- source/ext/openssl/openssl_missing.h.orig 2010-04-20 11:15:48.000000000 -0700
+++ source/ext/openssl/openssl_missing.h 2010-04-20 11:16:05.000000000 -0700
@@ -164,11 +164,11 @@
#endif
#if !defined(HAVE_BN_RAND_RANGE)
-int BN_rand_range(BIGNUM *r, BIGNUM *range);
+int BN_rand_range(BIGNUM *r, const BIGNUM *range);
#endif
@niw
niw / sweep_addressbook_images.rb
Created October 20, 2010 06:38
Cleaning up your massy ~/Library/Application Support/AddressBook/Images
#!/usr/bin/ruby
require 'rubygems'
require 'sqlite3'
require 'fileutils'
ADDRESS_BOOK_DIR = Dir.pwd
ABCDDB_PATH = File.join(ADDRESS_BOOK_DIR, "AddressBook-v22.abcddb")
unless File.exist?(ABCDDB_PATH)
@niw
niw / fix_appstore_font.command
Created January 6, 2011 16:17
Address AppStore.app Font issue
#!/bin/sh
echo '*{font-family:"Lucida Grande" !important;}' > ~/Library/Application\ Support/AppStore/UserStyleSheet.css
defaults write com.apple.AppStore WebKitUserStyleSheetEnabledPreferenceKey -bool true
defaults write com.apple.AppStore WebKitUserStyleSheetLocationPreferenceKey "~/Library/Application Support/AppStore/UserStyleSheet.css"
@niw
niw / gist:1055127
Created June 29, 2011 22:04
A bookmarklet to switch languages of search results (lr parameter).
javascript:(function(){var%20ls=[%22ja%22,%22en%22],re=/\blr=lang_([a-zA-Z][a-zA-Z])\b/,w=window,h=w.location.href,m=h.match(re);w.location=m?h.replace(re,%22lr=lang_%22+(ls[ls.indexOf(m[1])+1]||ls[0])):h+(h.match(/[?#]/)?%22&%22:%22?%22)+%22lr=lang_%22+ls[0];})()
@niw
niw / mozc_r57.patch
Created July 2, 2011 05:34
Mozc r57 patch
Index: renderer/mac/CandidateController.mm
===================================================================
--- renderer/mac/CandidateController.mm (revision 57)
+++ renderer/mac/CandidateController.mm (working copy)
@@ -91,6 +91,25 @@
}
}
+ // Make a visible rect which doesn't include Dock and menu bar area.
+ CGRect mainDisplayRect = CGDisplayBounds(CGMainDisplayID());
@niw
niw / remove_leopard_event_handler.sh
Created August 16, 2011 09:40
Remove SIMelop event handler to remove spurious entries in Console.app.
#!/bin/sh
/usr/libexec/PlistBuddy -c "Delete :OSAXHandlers:Events:SIMeleop" "/Library/ScriptingAdditions/SIMBL.osax/Contents/Info.plist"
@niw
niw / tumblr-blog.niw.at.html
Created September 30, 2011 23:05
Tumbler Theme for blog.niw.at
<!DOCTYPE html>
<html>
<!--
Copyright (c) 2011 Yoshimasa Niwa
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
@niw
niw / remove_all_urls_from_address_book.m
Created October 13, 2011 22:52
Remove all URLs from AddressBook.app
#import <AddressBook/AddressBook.h>
int main() {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
ABAddressBook *addressBook = [ABAddressBook sharedAddressBook];
ABSearchElement *searchElement = [ABPerson searchElementForProperty:kABURLsProperty
label:nil
key:nil
value:@"http://"