Skip to content

Instantly share code, notes, and snippets.

View skahack's full-sized avatar
🐳
...

Hiroki Sato skahack

🐳
...
View GitHub Profile
@skahack
skahack / aget0.4.1.patch
Created October 20, 2010 15:15
aget 0.4.1
--- Head.c 2009-05-12 14:22:42.000000000 +0900
+++ Head.c.new 2010-10-21 00:12:25.000000000 +0900
@@ -59,7 +59,7 @@
hstrerror(h_errno));
exit(1);
}
- strncpy(req->ip, inet_ntoa(*(struct in_addr *)he->h_addr), MAXIPSIZ);
+ strncpy(req->ip, inet_ntoa(*(struct in_addr *)he->h_addr_list[0]), MAXIPSIZ);
@skahack
skahack / Object.c
Created April 1, 2011 23:48
CでOO
#pragma once
#include <stdlib.h>
#include <stdarg.h>
typedef struct _Class * Class;
struct _Class {
size_t size;
void * (*new)(void *self, va_list *args);
framework 'Cocoa'
class AppDelegate
def applicationDidFinishLaunching(notification)
voice_type = "com.apple.speech.synthesis.voice.GoodNews"
@voice = NSSpeechSynthesizer.alloc.initWithVoice(voice_type)
end
def windowWillClose(notification)
@skahack
skahack / Info.plist
Created April 7, 2011 20:55
Statusbar application sample
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>statusbar</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>LSUIElement</key>
<true/>
@skahack
skahack / gist:918925
Created April 14, 2011 05:11
exec system command
- (NSString *)runCommand:(NSString *)command {
NSTask *task = [[NSTask alloc] init];
NSPipe *pipe = [[NSPipe alloc] init];
[task setLaunchPath: @"/bin/sh"];
[task setArguments: [NSArray arrayWithObjects:@"-c", command, nil]];
[task setStandardOutput: pipe];
[task launch];
@skahack
skahack / gist:965837
Created May 11, 2011 02:48
RFC: IMAP
Network Working Group M. Crispin
Request for Comments: 3501 University of Washington
Obsoletes: 2060 March 2003
Category: Standards Track
import System.Time
import System.Locale
import System.Posix.Env
main=do
putEnv("TZ=right/UTC")
interact$unlines.(>>= \s->[formatCalendarTime defaultTimeLocale "%Y-%m-%d %X".toUTCTime$TOD (case(read s::Integer)of;x|x>1230768022->x+1;x->x) 5]).lines
@skahack
skahack / description.md
Created May 27, 2011 20:33
GHUnit + Jenkins

XcodeProject作成(gitでバージョン管理)

GHUnit用Targetを追加


↓を実行 ruby setup.rb XcodeProjectフォルダ


以下はGHUnit用Targetに対して

@skahack
skahack / gist:1010405
Created June 6, 2011 14:58
Backspace、Function keyなどのイベントを送信
const unichar ch = NSBackspaceCharacter;
NSString *backspace = [NSString stringWithCharacters:&ch length:1];
NSEvent *e = [NSEvent keyEventWithType:NSKeyDown
location:NSMakePoint(0, 0)
modifierFlags:0
timestamp:0
windowNumber:0
context:[NSGraphicsContext currentContext]
characters:backspace
@skahack
skahack / README
Last active September 27, 2023 14:30
🐳