Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
import zipfile
from lxml import etree
def fb_info(fb):
xml = etree.XML(fb)
NODE = lambda n:xml.xpath('/fb:FictionBook/fb:description/fb:title-info/fb:'+n, namespaces={'fb':'http://www.gribuser.ru/xml/fictionbook/2.0'})
T = lambda n:n[0].text if len(n)>0 else ''
return {
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000f
Crashed Thread: 0
Thread 0 Crashed:
0 libobjc.A.dylib 0x00003ebc objc_msgSend + 20
1 UIKit 0x00087e30 -[UINavigationController topViewController] + 36
2 UIKit 0x00088248 -[UINavigationController _allowsAutorotation] + 72
3 UIKit 0x0006c630 -[UITabBarController _allowsAutorotation] + 120
4 UIKit 0x0006c570 -[UIViewController window:shouldAutorotateToInterfaceOrientation:] + 32
/*
* BIX creation utility
* Copyright (C) 2006 Eugene Konev
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
NSString *sPath = [[NSBundle mainBundle] pathForResource:@"pagetpl" ofType:@"html"];
NSMutableString *s = [NSMutableString stringWithContentsOfFile:sPath];
for(NSString *k in [NSArray arrayWithObjects:@"title", @"text", @"formattedDate", @"faviconDomain", nil]) {
[s
replaceOccurrencesOfString:[@"$" stringByAppendingString:k]
withString:[[entry valueForKey:k] description]
options:0
range:NSMakeRange(0, [s length])];
}
#include <stdio.h>
#include <math.h>
int main (int argc, const char *argv[])
{
int chislo, one, two, three, i, tet;
int size = 0;
for (tet = 10; tet < 999; tet++) {
int yes = yesNo(tet);
}
$ /Developer/usr/bin/clang --analyze gistfile1.c
gistfile1.c:9:7: warning: Value stored to 'yes' during its initialization is never read
int yes = yesNo(tet);
^ ~~~~~~~~~~
gistfile1.c:29:11: warning: Value stored to 'b' during its initialization is never read
unsigned b = one;
^ ~~~
gistfile1.c:36:2: warning: Variable-length array 'c' garbage value for array size
int c[size];
^ ~~~~
#include <stdio.h>
#include <unistd.h>
int main (int argc, const char *argv[])
{
int i, j;
const char *scroller = "|/-\\|/-\\";
j = 0;
for(i=0; i<20; ++i) {
printf("%c", scroller[j]);
- (void) selectView:(id)dummy
{
NSEvent *event;
id view;
NSCursor *cursor = [NSCursor crosshairCursor];
NSDate *distantFuture = [NSDate distantFuture];
NSRect infoRect = NSMakeRect(0, 0, 290, 100);
NSTextView *infoView = [[[NSTextView alloc] initWithFrame:NSZeroRect] autorelease];
[infoView setEditable:NO];
#!/bin/sh
#
# Wrapper for running Tomcat under launchd
# Required because launchd needs a non-daemonizing process
function shutdown()
{
$CATALINA_HOME/bin/shutdown.sh
/bin/rm $CATALINA_PID
}
from StringIO import StringIO
from django.core.serializers.python import Serializer as PythonSerializer
from django.core.serializers.python import Deserializer as PythonDeserializer
import plistlib
try:
import decimal
except ImportError:
from django.utils import _decimal as decimal # Python 2.3 fallback