-- Increment addresses, with increment of octet
select inet '192.168.0.1' + 256;
-- Increment addresses starting with a network
select cidr '192.168.100.128/25' + 256;
-- Get a cidr network address from shorthand
select cidr '10.1.2';
This file contains hidden or 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
public class Main { | |
private static String buildBigString (int numStrings) { | |
StringBuffer sb = new StringBuffer(); | |
for(int i = 0; i < numStrings; i++) { | |
sb.append("12345678"); | |
sb.append(","); | |
} | |
return sb.toString(); | |
} |
This file contains hidden or 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
# Sets up a development environment for Ubuntu 16.04. | |
sudo apt-get install -y curl | |
# Microsoft source | |
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg | |
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg | |
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" > /etc/apt/sources.list.d/dotnetdev.list' | |
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list' |
This file contains hidden or 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
async { | |
use conn = new NpgsqlConnection (connectionString) | |
use cmd = conn.CreateCommand (CommandText="SELECT field1, field5 FROM some_table WHERE foo=:bar") | |
cmd.Parameters.AddWithValue ("bar", "baz) |> ignore | |
do! conn.OpenAsync () |> Async.AwaitTask // Automatically closed when disposed | |
use! reader = cmd.ExecuteReaderAsync() |> Async.AwaitTask | |
// Need a function to iterate through results | |
let rec readData results = async { | |
let! hasRecord = reader.ReadAsync () |> Async.AwaitTask | |
match hasRecord with |
This file contains hidden or 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
#!/bin/bash | |
sudo apt-get clean # removes cached packages | |
sudo apt autoremove --purge # removes old kernels |
This file contains hidden or 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
namespace AzurefnSecret | |
open Microsoft.Azure.KeyVault | |
open Microsoft.IdentityModel.Clients.ActiveDirectory | |
module Example = | |
let getSecret (appKeyDescription:string) (appKeyValue:string) (secretUrl:string) = | |
async { | |
use keyVault = new KeyVaultClient(fun authority resource (_:string) -> | |
async { |
This file contains hidden or 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
// Works from .NET Core (netcoreapp2.0), just add nuget package FSharp.Compiler.Service | |
open System | |
open System.IO | |
open Microsoft.FSharp.Compiler.SourceCodeServices | |
let nugetPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), ".nuget") | |
let systemRuntimePath = Path.Combine(nugetPath, "packages/System.Runtime/4.3.0/ref/netstandard1.5/System.Runtime.dll") | |
[<EntryPoint>] |
This file contains hidden or 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
HOME:=$(shell pwd) | |
NAME:=someLargeProject | |
DOCKER_REPO := my.internal.repo | |
DOCKER_REPO_DIR := mystuff | |
BUILD_CONTAINER := microsoft/dotnet:2-sdk | |
BASE_VERSION = 2.0 | |
BUILD_NUMBER ?= 1 | |
VERSION = ${BASE_VERSION}.${BUILD_NUMBER} |
This file contains hidden or 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
type TraceLogger(name, minLevel) = | |
let logWithAck level fac = | |
if level < minLevel then async.Return () else | |
async { | |
let m = fac level | |
match m.value, level with | |
| Event event, _ when level >= LogLevel.Error -> | |
System.Diagnostics.Trace.TraceError(event, [||]) | |
| Event event, _ when level = LogLevel.Warn -> |
This file contains hidden or 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
Paket version 5.156.7 | |
found: /src/suaveapp/paket.dependencies | |
Parsing /src/suaveapp/paket.dependencies | |
Resolving packages for group Main: | |
0 packages in resolution. | |
1 requirements left | |
- Suave, 2.2.1 (from /src/suaveapp/paket.dependencies) | |
Trying to resolve Suave 2.2.1 (from /src/suaveapp/paket.dependencies) | |
Performance: |