This file contains 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
"""Compute solutions to the diophantine Pell equation x^2-D*y^2=1.""" | |
import itertools | |
def pell (D): | |
"""Return the smallest integer set solving Pell equation | |
x^2-D*y^2=1 where x, D and y are positive integers. If there are no | |
solution (D is a square), return None. | |
>>> pell(3) |
This file contains 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
USING: hash-sets kernel locals math sequences sets ; | |
IN: acm | |
:: add ( set n -- newset ) | |
HS{ } clone :> newset | |
set members [ n [ + ] [ - ] 2bi [ newset adjoin ] bi@ ] each newset ; | |
:: least ( n -- x ) | |
HS{ 0 } 1 [ [ add n over in? ] keep swap ] [ 1 + ] until nip ; |
This file contains 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
int netaccept(int fd, char *server, int *port) | |
{ | |
int cfd = 0; | |
int one = 0; | |
union { | |
struct sockaddr_in ipv4; | |
struct sockaddr_in6 ipv6; | |
} sa; | |
socklen_t len = sizeof sa; | |
int rc = 0, af; |
This file contains 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
// Compile with -std=gnu99 to get the proper definitions of struct addrinfo | |
#include <stdbool.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <netdb.h> | |
#include <arpa/inet.h> | |
#include <errno.h> | |
#include <netinet/in.h> |
This file contains 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
class Example { | |
println("Constructing an Example object: " + this) | |
} | |
object Test extends App { | |
// Return a new object of type T when called as f[T] | |
def f[T : Manifest] = manifest[T].erasure.getConstructor().newInstance() |
This file contains 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 scala.collection.mutable.{HashMap, Map} | |
import scala.concurrent.Channel | |
import scala.concurrent.ops.spawn | |
import android.content.Context | |
import android.os.{Handler, Message} | |
object AndroidBG { | |
private val androidBGs: Map[Context, AndroidBG] = new HashMap() |
This file contains 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
package cgeo.geocaching.maps; | |
import cgeo.geocaching.Settings; | |
import cgeo.geocaching.cgBase; | |
import cgeo.geocaching.cgSearch; | |
import cgeo.geocaching.geopoint.Geopoint; | |
import org.apache.commons.lang3.StringUtils; | |
import android.os.Handler; |
This file contains 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 akka.actor._ | |
import akka.event.Logging | |
object Bug extends App { | |
ActorSystem("Bug").actorOf(Props[Bug]) | |
} | |
class Bug extends Actor with FSM[Int, (Int, Int)] { |
This file contains 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
V/NetworkChangeReceiver( 2372): Network Change | |
D/FREEMOBILE( 1848): ----------------------------------- UTILS ------------------------- | |
D/FREEMOBILE( 1848): : true | |
D/FREEMOBILE( 1848): R :1 | |
D/FREEMOBILE( 1848): ### Receiver : android.net.conn.CONNECTIVITY_CHANGE | |
W/System.err( 1848): android.provider.Settings$SettingNotFoundException: button_mvno_roaming_key | |
W/System.err( 1848): at android.provider.Settings$System.getInt(Settings.java:908) | |
W/System.err( 1848): at fr.freemobile.android.mobileconfig.RoamingListener.checkRoamingStatus(RoamingListener.java:142) | |
W/System.err( 1848): at fr.freemobile.android.mobileconfig.RoamingListener.onReceive(RoamingListener.java:90) |
This file contains 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
# Contributor: Kyle Keen <keenerd@gmail.com> | |
pkgname=saleae-logic | |
pkgver=1.1.15 | |
pkgrel=3 | |
pkgdesc="High speed USB logic analyzer." | |
arch=(i686 x86_64) | |
url="http://www.saleae.com/" | |
license=('unknown') # closed source, none given | |
depends=('gcc-libs' 'gtk2' 'libice') | |
makedepends=() |
OlderNewer