This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma mark - NSCoding | |
- (id)initWithCoder:(NSCoder *)decoder { | |
self = [super init]; | |
if (!self) { | |
return self; | |
} | |
unsigned int count; | |
objc_property_t *properties = class_copyPropertyList([self class], &count); | |
for (NSUInteger i = 0; i < count; i++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void to_binary(unsigned long n) | |
{ | |
int r; | |
r = n % 2; | |
if (n >= 2) | |
to_binary(n / 2); | |
putchar('0' + r); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Licensed under the MIT License | |
Copyright (c) 2011 Cédric Luthi | |
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 permit persons to whom the Software is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: UTF-8 -*- | |
import os | |
import sys | |
from Queue import Queue | |
import random | |
import threading | |
import time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import random | |
class Customer: | |
def __init__(self, id): | |
self.id = id | |
self.foods = [] | |
self.start = time.time() | |
def choose_foods(self): | |
self.foods = random_choose(5) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import threading | |
import urllib2 | |
import time, random | |
class GrabUrl(threading.Thread): | |
def __init__(self, arg0): | |
threading.Thread.__init__(self) | |
self.host = arg0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python2.7 | |
x = [ | |
{ "a": "hoooooo", | |
"b": "wo", | |
"c": "rrrruuu", | |
}, | |
{ | |
"a": "en?", | |
"b": "wwwwlllllyyy", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python2.7 | |
grad = {} | |
stu = {} | |
with open("input.txt") as f: | |
for l in f: | |
name, score = l.strip().split() | |
if name not in grad: | |
grad[name] = 0 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python2.7 | |
section = "" | |
ini_dict = {} | |
with open("input.txt") as f: | |
for l in f: | |
x = l.strip() | |
if not x: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/sh | |
pipe=/tmp/out | |
#trap "rm -rf $pipe" EXIT | |
#if [[ ! -p $pipe ]]; then | |
# mkfifo $pipe | |
#fi | |
out=1 | |
while true | |
do |