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
/* xscreensaver, Copyright (c) 1992-2008 Jamie Zawinski <[email protected]> | |
* | |
* Permission to use, copy, modify, distribute, and sell this software and its | |
* documentation for any purpose is hereby granted without fee, provided that | |
* the above copyright notice appear in all copies and that both that | |
* copyright notice and this permission notice appear in supporting | |
* documentation. No representations are made about the suitability of this | |
* software for any purpose. It is provided "as is" without express or | |
* implied warranty. | |
*/ |
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 random | |
def sort(a, feedback=False): | |
lower_limit = 0 | |
upper_limit = len(a) - 1 | |
steps = 0 | |
while(lower_limit != upper_limit ): | |
i = lower_limit | |
while i < upper_limit - 1: |
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
object Scramble extends App { | |
val words = io.Source.fromFile("/usr/share/dict/words").getLines() | |
val uniques = words.filter(! _.contains("'")).toList | |
// group words by what you get when you sort their individual characters | |
val scrambled_lookup = uniques.map(w => w.toList.sorted.mkString).zip(uniques).groupBy(_._1).map { | |
case (scrambled, ws) => (scrambled, ws.map(_._2)) | |
} | |
// words whose sorted versions collide | |
val non_uniques = scrambled_lookup.toList.map(_._2).sortWith(_.length > _.length).filter(_.length > 1) |
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
// this is kind of a hack since App Engine doesn't support OAuth 2, but that's the | |
// only version of OAuth that's natively supported by Android | |
val token = settings.getString("oauth2_token", "") | |
// send OAuth token to appspot login page | |
// response will contain a valid cookie | |
val req = new HttpGet("https://x-allow-oauth-dot-google-showy.appspot.com/_ah/login?continue=http://localhost/&auth=" + token); | |
val client = new DefaultHttpClient() | |
// avoid redirects - we are only interested in the cookie, not any content | |
client.getParams.setBooleanParameter(ClientPNames.HANDLE_REDIRECTS, false) | |
// we are not interested in the result, so no need to save it |
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 EasyJSON | |
import net.minidev.json.JSONValue | |
import net.minidev.json.JSONArray | |
import net.minidev.json.JSONObject | |
import scala.collection.JavaConversions._ | |
object JSON { | |
def parseJSON(s: String) = new ScalaJSON(JSONValue.parse(s)) |
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
:- initialization(solve). | |
solve :- sudoku([_, _, 1, _, _, _, 8, _, _, | |
_, 7, _, 3, 1, _, _, 9, _, | |
3, _, _, _, 4, 5, _, _, 7, | |
_, 9, _, 7, _, _, 5, _, _, | |
_, 4, 2, _, 5, _, 1, 3, _, | |
_, _, 3, _, _, 9, _, 4, _, | |
2, _, _, 5, 7, _, _, _, 4, | |
_, 3, _, _, 9, 1, _, 6, _, |
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
scalaVersion in ThisBuild := "2.10.0" | |
scalacOptions in ThisBuild += "-language:experimental.macros" | |
libraryDependencies in ThisBuild ++= Seq( | |
"org.scala-lang" % "scala-reflect" % "2.10.0" | |
) |
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
#!/usr/bin/python | |
import random | |
try: | |
from termcolor import colored | |
except ImportError: | |
def colored(s, color): | |
return s | |
ERROR = 0 |
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
cmake_minimum_required(VERSION 2.6) | |
project(task1) | |
set(CMAKE_CXX_FLAGS "-g -Wall") | |
add_executable(sdc_client sdc_client.cpp) | |
target_link_libraries(sdc_client boost_program_options) |
OlderNewer