Skip to content

Instantly share code, notes, and snippets.

View AndreaCrotti's full-sized avatar

Andrea Crotti AndreaCrotti

View GitHub Profile
@AndreaCrotti
AndreaCrotti / create_table_from_sqlalchemy.py
Created August 10, 2015 12:57
print out schema from sqlalchemy
import argparse
import inspect
from importlib import import_module
from sqlalchemy import create_engine
from sqlalchemy.schema import CreateTable
from skim.slxmodels.meta import BaseModel
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
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

(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

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{soul}
\usepackage{amssymb}
\usepackage{hyperref}
destination df_sshd {
file("/var/log/sshd.log");
};
filter sshd {
program(sshd);
};
log {
source(s_all);
filter(sshd);
destination(df_sshd);
;; 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
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
#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);
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