Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
throwExceptions="false">
<!-- optional, add some variables
https://github.com/nlog/NLog/wiki/Configuration-file#variables
-->
<variable name="myvar" value="myvalue"/>
@denmerc
denmerc / postgres-cheatsheet.md
Created August 28, 2018 18:40 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@denmerc
denmerc / PaketDependencyManagementMadeEasy.fsx
Created June 10, 2018 17:29 — forked from realvictorprm/PaketDependencyManagementMadeEasy.fsx
A must have for your script file to ease spreading a small proof of concept with dependencies!
open System
open System.IO
open System.Diagnostics
let downloadDependencies deps =
Environment.CurrentDirectory <- __SOURCE_DIRECTORY__
if not (File.Exists "paket.exe") then
async {
let url = "http://fsprojects.github.io/Paket/stable"
@denmerc
denmerc / WebApp.fs
Created May 25, 2018 04:21 — forked from ane/WebApp.fs
Simple DTO passing in F# using Suave.
// Learn more about F# at http://fsharp.org
// See the 'F# Tutorial' project for more help.
open Suave
open Suave.Json
open Suave.Types
open Suave.Types.Methods
open Suave.Utils
open Suave.Http
open Suave.Http.Authentication
open Suave.Http.Writers
@denmerc
denmerc / asyncWorkflow.fs
Last active March 6, 2018 04:10 — forked from mausch/gist:3188428
Async exception handling in F#
open System
open System.Net
// exception handling in async using Async.Catch
let fetchAsync (name, url:string) =
async {
let uri = new System.Uri(url)
let webClient = new WebClient()
let! html = Async.Catch (webClient.AsyncDownloadString(uri))
match html with
@denmerc
denmerc / curl.sh
Created February 13, 2018 00:58
Bulk elastic loading
# new line json
curl -H 'Content-Type: application/x-ndjson' -XPOST 'localhost:9200/bank/account/_build?pretty' --data-binary @accounts.json
# in kibana
GET _cat/indices
GET bank
# setting data type mappings
PUT /logstash-2015.05.05
@denmerc
denmerc / Dockerfile
Created February 12, 2018 23:50
.net core with Docker
# "Dockerfile" to save w/o extension
FROM microsoft/dotnet:latest
COPY . /app
WORKDIR /
RUN dotnet restore
RUN dotnet build
EXPOSE 5000/tcp
ENV ASPNETCORE_URLS http://*:5000
@denmerc
denmerc / nginx.conf
Created February 12, 2018 22:55
.net core on linux with linux
# sudo apt-get install nginx
# sudo service nginx start
# /etc/nginx/sites-available/default
server {
listen 80;
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
@denmerc
denmerc / Dockerfile
Created January 12, 2018 20:06 — forked from lenadroid/Dockerfile
Example F# Job template for Kubernetes
FROM fsharp
COPY . .
RUN mono ./.paket/paket.bootstrapper.exe
RUN mono ./.paket/paket.exe restore
RUN mono .paket/paket.exe install
version: '2'
services:
elasticsearch:
build: elasticsearch/
volumes:
- ./config/elasticsearch/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
# add rotating log conf
- ./config/elasticsearch/logging.yml:/etc/elasticsearch/logging.yml