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.ast.scripts.db | |
import groovy.sql.Sql | |
import org.ofbiz.core.entity.TransactionFactory | |
import org.ofbiz.core.entity.ConnectionFactory | |
import java.sql.Connection | |
Connection connection = TransactionFactory.getConnection("defaultDS") | |
Connection connection2 = ConnectionFactory.getConnection("defaultDS") |
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
Get-Item -Path env: | |
Get-Item -Path env:JAVA_HOME | |
# Job | |
Get-Job -State Started | |
Get-Job -Name "ja*" | |
# SET | |
Set-Item -Path env:JAVA_HOME -Value "C:\Users\andrii\java" |
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
Gatherer<URI, ?, String> mapToCOntents = gatherers.mapCOncurrent(16, uri -> { | |
try { | |
return fetch(uri); | |
} catch(IOEsception e) { | |
throw new UncheckedIOEsception(e); | |
}; | |
String result = Stream.of(uris) | |
.gather(mapToContents) |
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
## GET request | |
GET / HTTP/1.1 | |
User-agent: curl/2000 | |
Host: example.com | |
## GET response | |
HTTP/1.1 200 OK | |
Server: example-server/1.1 | |
Content-Length: 5 | |
Content-Type: plain/text |
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
module SleighAuthenticationSpec where | |
import SleighAuthentication (authenticate) | |
import Test.Hspec | |
import Test.QuickCheck | |
spec :: Spec | |
spec = do | |
describe "authenticate" $ do | |
it "should work for some examples" $ do | |
expectTrue $ authenticate "Santa Claus" "Ho Ho Ho!" |
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
func (b *Bus) readAndUnpack() ([]byte, error) { | |
n, err := io.ReadAtLeast(b.port, b.buf[:], 2) | |
got := b.buf[:n] | |
if err != nil { | |
return nil, newError("libzzz: cannot read 2-byte preamble [got: % 02X] - error: %w", got, err) | |
} | |
if got[0] != magic_number { | |
return nil, newError("libzzz: bad MAGIC NUMBER in response - message starts with: [% 02X] (expected XX...)", got) | |
} | |
length := int(got[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
# Copyright 2017 Google Inc. All Rights Reserved. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |
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 the official lightweight Node.js 12 image. | |
# https://hub.docker.com/_/node | |
FROM node:12-slim | |
# Create and change to the app directory. | |
WORKDIR /usr/src/app | |
# Copy application dependency manifests to the container image. | |
# A wildcard is used to ensure copying both package.json AND package-lock.json (when available). | |
# Copying this first prevents re-running npm install on every code change. |
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.anma.java.core.nio; | |
import java.io.IOException; | |
import java.nio.file.*; | |
import java.nio.file.attribute.BasicFileAttributes; | |
import java.nio.file.attribute.FileTime; | |
import java.util.EnumSet; | |
import static java.nio.file.FileVisitResult.CONTINUE; | |
import static java.nio.file.FileVisitResult.SKIP_SUBTREE; |
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 std::io::{Read, Write}; | |
use std::{net, time}; | |
use std::future::Future; | |
fn main() { | |
let port = 8084; | |
let server = net::TcpListener::bind(format!("127.0.0.1:{port}")).unwrap(); |
NewerOlder