(defun check-problem (id ext) (interactive) (setq ext (downcase ext)) (cond ((file-exists-p (make-name id ext)) (concat ”X”)) ((file-exists-p (temp-name id ext)) (concat ”?”)) (t ;; Otherwise create a link for a new file
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
eval2 :: Term -> MyMaybe2 Float | |
eval2 (Log x) = do | |
y <- eval2 x | |
if y <= 0 | |
then Error2 ("Cannot take logarithm of non-positive number " ++ show y ++ "!") | |
else return $ log y |
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
from utils import divisors | |
from itertools import product | |
def perfection(n): | |
"1 abundant, 0 perfect, -1 deficient" | |
return cmp(sum(divisors(n)[:-1]), n) | |
# Find the sum of all the positive integers which cannot be written as the sum of two abundant numbers. | |
BIG = 28123 |
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
\documentclass[11pt]{article} | |
\usepackage[utf8]{inputenc} | |
\usepackage[T1]{fontenc} | |
\usepackage{graphicx} | |
\usepackage{longtable} | |
\usepackage{float} | |
\usepackage{wrapfig} | |
\usepackage{soul} | |
\usepackage{amssymb} | |
\usepackage{hyperref} |
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
destination df_sshd { | |
file("/var/log/sshd.log"); | |
}; | |
filter sshd { | |
program(sshd); | |
}; | |
log { | |
source(s_all); | |
filter(sshd); | |
destination(df_sshd); |
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
;; TextMate behaviour on Emacs | |
;; Copyright (C) 2008 Orestis Markou | |
;; This program is free software; you can redistribute it and/or | |
;; modify it under the terms of the GNU General Public License | |
;; as published by the Free Software Foundation; either version 2 | |
;; of the License, or (at your option) any later version. | |
;; This program is distributed in the hope that it will be useful, | |
;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
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
from itertools import permutations, count | |
# this appears the fastest way to do it | |
dim = 10 | |
pandigs = permutations(map(str, xrange(dim-1, 0, -1))) | |
pan_numbers = (''.join(x) for x in pandigs) | |
def prob_38(): | |
for n in pan_numbers: | |
#print "checking ", n |
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 <stdlib.h> | |
#include <stdio.h> | |
#include <time.h> | |
#include "utils.h" | |
#define LEN 10 | |
// To test my result print them to file and then load the results in octave | |
double *my_trsv(double *, double *, 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
function x = trsv(L, y, b, alg) | |
len = length(L); | |
req = len / b; | |
## this could be whatever, after I overwrite any value present | |
x = 1:len | |
## the condition on size(Ltl) is automatically fulfilled here | |
for idx = 0:req | |
step = idx | |
s = idx * b; | |
## avoiding overflow when b > 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
function x = trsv(L, y, b, alg) | |
len = length(L); | |
req = len / b; | |
## this could be whatever, after I overwrite any value present | |
x = 1:len | |
## the condition on size(Ltl) is automatically fulfilled here | |
for idx = 0:req | |
step = idx | |
s = idx * b; | |
## avoiding overflow when b > 1 |
OlderNewer