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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <gmp.h> | |
#include <gc/gc.h> | |
mpz_t * | |
fact(unsigned n) | |
{ | |
mpz_t *res; |
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/env gsi-script | |
(define (fact n) | |
(let loop ((n n) (r 1)) | |
(if (< n 2) | |
r | |
(loop (- n 1) (* r n))))) | |
(if (not (= (length (command-line)) 2)) | |
(println "usage: fact1.scm NUMBER") |
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/env python | |
def fact(n): | |
r = 1 | |
while n > 1: | |
r *= n | |
n -= 1 | |
return r | |
from sys import argv |
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/env clojure | |
; vim:ft=clojure | |
(defn fact [n] | |
(loop [n n f 1] | |
(if (= n 1) | |
f | |
(recur (dec n) (* f n))))) | |
(if (not= (count *command-line-args*) 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
_gitsync() { | |
if [ $# -eq 1 ]; then | |
repo=origin | |
else | |
repo=$2 | |
fi | |
branch=$(git branch --no-color | grep '^*' | awk '{print $2}') | |
if [ -z "$branch" ]; then | |
# git will show an appropriate error | |
return 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
user=> (use '[clojure.java.io :only (reader)]) | |
nil | |
user=> (spit "/tmp/blah" "blah blah") | |
nil | |
user=> (slurp (reader "/tmp/blah")) | |
"blah blah" | |
user=> |
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
(use '[clojure.set :only (union)]) | |
(def *count* (atom 10)) | |
(defn get-entries [] | |
(let [n (swap! *count* inc)] | |
(map (fn [i] {:id i :title (str "title " i)}) (range n)))) | |
(defn process-entry [entry] | |
(println (:title entry))) |
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
user = users.get_current_user() | |
if not user: | |
raise HTTPRedirect(users.create_login_url(cherrypy.request.path_info))) |
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 'java.io.File) | |
(require '[clojure.zip :as zip]) | |
(defn branch? [f] | |
(.isDirectory f)) | |
(defn children [f] | |
(.listFiles f)) | |
(defn iterzip [z] |
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 com.adconion.ntdw.util; | |
import org.testng.annotations.DataProvider; | |
import org.testng.annotations.Test; | |
import com.adconion.AbstractDatabaseTest; | |
@Test(groups = "functest", sequential = true) | |
public class NamedQueriesTest extends AbstractDatabaseTest { | |
@DataProvider(name = "beans") |
OlderNewer