Skip to content

Instantly share code, notes, and snippets.

Animal = {}
function Animal:new(o)
o = o or {}
setmetatable(o, self)
self.__index = self
return o
end
@jj1bdx
jj1bdx / sunrise.py
Created October 6, 2009 03:42
PyEphem script to show sunrise and sunset
#!/usr/local/bin/python
# a Python script for PyEphem
# http://rhodesmill.org/pyephem/
# to find out the sunrise and sunset time
# in UTC
# (add more code for the local time by yourself)
# by Kenji Rikitake 6-OCT-2009
from datetime import datetime, timedelta
@Madsy
Madsy / io.s
Created January 21, 2010 22:15
.section .text
.arm
.globl strlen
strlen:
mov r1, r0
mov r0, #0
loopstart:
ldr r2, [r1], #1!
cmp r2, #0
addne r0, r0, #1
@rjungemann
rjungemann / Communicator.h
Created June 21, 2010 00:45
How to open a TCP socket in Objective-C
#import <Foundation/Foundation.h>
@interface Communicator : NSObject <NSStreamDelegate> {
@public
NSString *host;
int port;
}
- (void)setup;
@RobertAudi
RobertAudi / osascript_shebang.sh
Created June 30, 2010 03:56
AppleScript shebang
#!/usr/bin/osascript
;; Copyright (c) 2010 Jeremiah LaRocco
;; All rights reserved.
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions
;; are met:
;; 1. Redistributions of source code must retain the above copyright
;; notice, this list of conditions and the following disclaimer.
;; 2. Redistributions in binary form must reproduce the above copyright
;; notice, this list of conditions and the following disclaimer in the
@bellbind
bellbind / hello.s
Created December 26, 2010 13:55
[arm][linux] Assembly main on ARM linux eabi
@ Assembly main on ARM linux eabi
@ [build and run on ubuntu x64]
@ arm-linux-gnueabi-gcc hello.s -o hello
@ qemu-arm -L /usr/arm-linux-gnueabi/ hello
stdout = 1
.text
.align 2
.global main
main:
push {r4-r11, lr}
#import <Foundation/Foundation.h>
#import <CoreServices/CoreServices.h>
// adjective
// 1 imaginative or fanciful; remote from reality
// 2 extraordinarily good or attractive
// DERIVATIVES
// fantastical adjective (in sense 1) .
// fantasticality noun (in sense 1) .
// fantastically adverb
@robotarmy
robotarmy / nintendo-ds.s
Created January 17, 2011 00:46
strange animation - what is happening to the machine?
.arm
.align
.global initSystem
.global main
initSystem:
bx lr
main:
mov r0,#0x04000000 @ I/O space offset
/*
Example CUDA code for Problem Set 0, CS 264, Harvard, Fall 2009.
Takes an input string and mangles it using the current date and
time on the CPU and on the GPU. Demonstrates device initialization
and error checking with libcutil, host<=>device memory transfers,
and CUDA kernel invocation.
To compile: