- 1
http://cs543107.vk.me/v543107084/f49c/quBsGLPz-lE.jpg
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+4
http://cs543107.vk.me/v543107084/f49c/quBsGLPz-lE.jpg
Программирование по-русски глазами американцев...
Сериал: "Агенты Щ.И.Т."; Сезон: 3; Эпизод: 13
+5
https://meduza.io/shapito/2016/03/24/iskusstvennyy-intellekt-ot-microsoft-za-sutki-polyubil-gitlera-i-voznenavidel-feministok
RIP in peace, nazi AI ;_;
−2
// POST /login
exports.login = function login(req, res) {
var email = req.body.email;
var password = req.body.password;
security.rateLimitRequest( 'reset', req, function( err ) {
if ( err )
return res.status( 400 ).send( err );
db.Account.find({email: email, password: password}, function(err, account) {
if ( err )
return res.status( 400 ).send( err );
account.getAccountStatistics(account, function(err, account) {
if ( err )
return res.status( 400 ).send( err );
account.incrementAccountLoginCount(account, function(err) {
if ( err )
return res.status( 400 ).send( err );
res.send(account);
});
});
});
});
});
У меня радость во все поля:
// POST /login
exports.login = function *login() {
var email = req.body.email;
var password = req.body.password;
try
{
// Throws an error if rate limit exceeded
yield security.rateLimitRequest( 'reset', req );
// Query MongoDB for account
var account = yield db.Account.find({email: email, password: password});
account.statistics = yield account.getAccountStatistics(account);
// Increment login count
yield account.incrementAccountLoginCount(account);
this.body = account;
}
catch( err ) {
// Return the error as JSON
return res.status( 400 ).send( err );
}
});
−1
(* basic power axiom
safe_comp_power x y =
case
(x = 0) and (y <> 0) -> 1
(x = 1) -> x
((x <> 0) and (y >= 0)) or ((x = 0) and (y > 0)) -> x * (safe_comp_power x (y - 1))
*)
logic safe_comp_pow : int, int -> int
axiom safe_comp_pow_int_A_1 : forall x : int. (x <> 0) -> safe_comp_pow(x, 0) = 1
axiom safe_comp_pow_int_A_2 : forall x : int. safe_comp_pow(x, 1) = x
axiom safe_comp_pow_int_A_3 : forall x,y : int. ((x <> 0) and (y >= 0)) or ((x = 0) and (y > 0)) -> safe_comp_pow(x, y) = x*(safe_comp_pow(x,y-1))
goal g_1 :
forall a,n : int.
a <> 0 -> n >= 0 ->
safe_comp_pow(a,n+1) = safe_comp_pow(a,n)*a
Язык для SMT солвера alt-ergo https://alt-ergo.ocamlpro.com/try.php . Аксиомы для возведения в степень. Возводить в отрицательную степень нельзя. Ноль в степени ноль - нельзя. Логика первого порядка. Должна быть справедлива для целых. Правда в одной аксиоме я допустил баг. Я его уже нашел. Можете тоже попробовать найти его
+1
https://habrahabr.ru/company/tm/blog/279759/
На Швабре можно постить гоатсе.
+4
{- This code intentionally was made slightly cryptic -}
{-# LANGUAGE GADTs, StandaloneDeriving, UnicodeSyntax, KindSignatures, FlexibleInstances, LambdaCase, CPP, BangPatterns #-}
import System.Exit
import Data.Functor
import Control.Monad.IO.Class
import Control.Monad.Trans.Cont
import System.Random
import System.Posix.Signals
import System.Environment
import Control.Concurrent.MVar
instance Eq (Int → Int) where
_ == _ = True -- It's a hack
infixl 7 :.
data T ∷ * where {J, Â, Â', S, K ∷ T; (:.) ∷ T → T → T; Ψ ∷ {σ ∷ String} → T
;F ∷ (Int → Int) → T; N ∷ Int → T; Ø ∷ String → T}
parse ∷ String → [T] → T
parse ('f':'u':c) t = parse c (J:t)
parse ('b':'a':'r':c) t = parse c (Â:t)
parse ('~':c) (a:b:t) = parse c (b:.a:t)
parse ('~':_) _ = error "Parse error: missing operand(s)"
parse (_:c) t = parse c t
parse [] (h:_) = h :. Ψ []
parse [] [] = error "Parse error: empty program"
s ∷ T → T
s (J :. x) = (x :. S) :. K
s (K :. x :. _) = x
s (S :. x :. y :. z) = (x :. z) :. (y :. z)
s (F f :. N i) = N $ f i
s (F f :. F g) = F $ f . g
s (Â' :. N i :. ψ @ (Ψ {})) = ψ {σ = toEnum i : σ ψ}
s (Â :. n :. ψ @ (Ψ {})) = Â' :. (n :. F (+1) :. N 0) :. ψ
-- Other cases
s (a :. b) = (s a) :. (s b)
s x = x
eval ∷ (T → t) → (T → t) → T → t
eval fp done t | t == t' = done t
| otherwise = fp t'
where t' = s t
ψs a@Ψ{σ=s} = [(a, s)]
ψs (a:.b) = ψs a ++ ψs b
ψs _ = []
r' ∷ T → [(T, String)] -- Very inefficient; should be rewritten
r' a | null t = [(a, s)] where ((_, s):t) = ψs a
r' (a :. b) = r' a ++ r' b
r' _ = []
r ∷ T → IO (Maybe T)
r t = case r' t of
[] → return Nothing
t' → ((t' !!) <$> randomRIO (0, length t' - 1)) >>= \case
(Ψ{}, s) → putStrLn (reverse s) >> return Nothing
(t'', s) → putStrLn (reverse s) >> return (Just t'')
setMVar v = (tryTakeMVar v >>) . putMVar v
loop v f n = callCC $ \done → loop1 done (\fp → f fp done) n
where loop2 interrupt f' n = do
n' ← liftIO (readMVar v) >>= \case
0 → f' interrupt n
_ → callCC $ \fp → f' fp n
liftIO $ modifyMVar_ v $ (\k → return $ k-1)
loop2 interrupt f' n'
loop1 done f' n = do
n' ← callCC $ \int → loop2 int f' n
liftIO $ putStrLn "Measure (m) Abort (a) Continue (c) Run steps (number)"
(liftIO getLine) >>= \case
"a" → f' done n' >> return ()
"c" → liftIO $ setMVar v (-1)
"m" → liftIO (r n') >>= \case
Nothing → liftIO exitSuccess
Just n'' → loop1 done f' n'' >> return ()
a → case readsPrec 0 a of
(n,_):_ → liftIO $ setMVar v n
_ → liftIO $ putStrLn "Not understood."
loop1 done f' n'
main ∷ IO ()
main = do
(file, n) ← getArgs >>= \case
[f] → return (f, -1)
["-s", n, f] → case readsPrec 0 n of
(n',_):_ → return (f, n')
_ → error "Argument of -s should be a number"
_ → error "Insufficient arguments. Expected [-s NUMBER_OF_STEPS] FILE"
cnt ← newMVar n
installHandler keyboardSignal (Catch $ setMVar cnt 0) Nothing
void $ (r =<<) (evalContT $ loop cnt eval =<< (parse <$> readFile file))
больше трясин богу тьюринг-полноты
1) литературное программирование
2) зайчатки REPL
3) чисто функциональное IO без манад и uniq-types
4) "квантовые" вычисления
5) только два комбинатора
−1
FROM centos:7
RUN yum update -y && yum -y install openssh-server ssh
RUN echo 'root:123456' | chpasswd
RUN passwd -u root
RUN ssh-keygen -A
RUN ssh-keygen -t rsa -b 4096 -C "[email protected]" -N "" -f /root/.ssh/id_rsa
RUN cat /root/.ssh/id_rsa.pub > /root/.ssh/authorized_keys
RUN chmod 600 /root/.ssh/id_rsa.pub
ADD ./ssh_config /etc/ssh/ssh_config
ADD ./sshd_config /etc/ssh/sshd_config
CMD ["/bin/sh", "-c", "{ while :; do /usr/sbin/sshd -eD ; done }"]
docker build --name trolleybus-is-hleba .
+4
program Project2;
procedure test1;
var
arr:array[0..32] of char;
begin
fillchar(arr,sizeof(arr),'A');
end;
procedure test2;
var
arr:array[0..32] of char;
begin
fillchar(arr,sizeof(arr) div 2,'B');
writeln(arr);
end;
begin
test1;
test2;
//BBBBBBBBBBBBBBBBAAAAAAAAAAAAAAA
readln;
end.
http://ideone.com/qJajnb
0
objNewFile.WriteLine " if (!table.nodeType) table = document.getElementById(table)"
objNewFile.WriteLine " var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML}"
objNewFile.WriteLine " window.location.href = uri + base64(format(template, ctx))"
objNewFile.WriteLine "}"
objNewFile.WriteLine "})()"
objNewFile.WriteLine "</script>"
objNewFile.WriteLine "<input type=""button"" onclick=""tableToExcel('table1', 'Export data')"" value=""Export data to Excel"">"
objNewFile.WriteLine "<table id=""table1"" BORDER=""1"" width=""100%"">"
objNewFile.WriteLine "<tr><th width=""2%"">id</th><th>Computer</th><th>AV Name</th><th>AV Status</th><th>AV Bases</th><th>Host Status</th></tr>"
for each comp in comps
compid = compid + 1
Set WshShell = WScript.CreateObject("WScript.Shell")
Ping = WshShell.Run("ping -n 1 " & comp, 0, True)
Select Case Ping
Case 0
On Error Resume next
Set oWMI = GetObject("winmgmts:\\" & comp & "\root\SecurityCenter2")
On Error Resume next
Set colAVItems = oWMI.ExecQuery("Select * from AntiVirusProduct")
If colAVItems.count = 0 Then
objNewFile.WriteLine "<tr><th>" & compid & "</th><th>" & comp & "</th><th><font color=""red"">No AntiViruses found</font></th><th><font color=""red"">Disabled</font></th><th><font color=""red"">NOT Up to Date</font></th><th><font color=""green"">Online</font></th></tr>"
И это висит на главной Волан-де-сайта!
+8
TOO_ENOUGH_DATA