Skip to content

Instantly share code, notes, and snippets.

View valyagolev's full-sized avatar
💭
hey there! i'm using github

Valentin Golev valyagolev

💭
hey there! i'm using github
View GitHub Profile
// pe92.cpp: определяет точку входа для консольного приложения.
//
// на хаскеле это
// print $ length $ filter (==89) $ map end [1..10000000]
// where end x = if (r == 89 || r == 1) then r else (end r)
// where r = sum $ map (^2) $ map digitToInt $ show x
#include "stdafx.h"
import List ( elemIndex )
import Char ( digitToInt )
check ones nines [] = length nines
check ones nines (x:xs) = if (ending x) == 1 then check (x:ones) nines xs else 1 + check ones (x:nines) xs
where
ending 1 = 1
ending 89 = 89
ending x = case elemIndex x ones of
Just _ -> 1
/* GHC_PACKAGES haskell98 random-1.0.0.1 process-1.0.1.1 directory-1.0.0.3 old-time-1.0.0.2 old-locale-1.0.0.1 filepath-1.1.0.2 Win32-2.2.0.0 bytestring-0.9.1.4 array-0.2.0.0 syb base integer ghc-prim rts
*/
#include "Stg.h"
EI_(base_GHCziFloat_zdf8_closure);
static StgWord rJp_srt[] = {
(W_)&base_GHCziFloat_zdf8_closure
};
II_(rJp_info);
static StgWord rJp_closure[] = {
import List (sortBy)
isInteger :: Rational -> Bool
isInteger x = (toRational (truncate x)) == x
isQuad :: (Floating a, Real a) => a -> Bool
isQuad x = isInteger (toRational (sqrt x))
findMinX :: (Floating a, Real a, Enum a) => a -> a
// pe205.cpp: определяет точку входа для консольного приложения.
//
#include "stdafx.h"
int* add_one(int* brs, int max, int count) {
for (int i = count-1; i >= 0; i--) {
if (brs[i] < max) {
brs[i]++;
for (int j = i+1; j < count; j++) {
@valyagolev
valyagolev / localized_models.py
Created November 10, 2010 03:16
Localized Models generator
# -*- coding: utf-8 -*-
from django.db import models
from django.contrib import admin
from copy import copy
LANGUAGES = ((2, 'Английский'),)
class LocalizedModel(models.Model):
language = models.IntegerField('язык', choices=LANGUAGES, default=2)
__________________
/media/oldroot/home/valentin/Work/buzzoola/buzzoola/chef-repo
[.../chef-repo]$ knife role list
[
"database",
"frontend",
"worker"
]
__________________
/media/oldroot/home/valentin/Work/buzzoola/buzzoola/chef-repo
[.../chef-repo]$ knife ssh "role:frontend" "uptime"
WARN: Failed to connect to node[i-226c9f4d] -- SocketError: getaddrinfo: Name or service not known
WARN: Failed to connect to node[i-ee50a381] -- SocketError: getaddrinfo: Name or service not known
__________________
/media/oldroot/home/valentin/Work/buzzoola/buzzoola/chef-repo
[.../chef-repo]$ knife ssh "role:frontend" "uptime" -a "cloud.public_ips[0]"
FATAL: No nodes returned from search!
Traceback (most recent call last):
File "./manage.py", line 15, in <module>
execute_manager(settings)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 220, in execute
@valyagolev
valyagolev / __init__.py
Created April 29, 2011 02:46
Django settings awesomness
from .base import *
try:
from .local import *
except ImportError:
pass