Skip to content

Instantly share code, notes, and snippets.

View mdmsua's full-sized avatar
🇺🇦
#StandWithUkraine

Dmytro Morozov mdmsua

🇺🇦
#StandWithUkraine
View GitHub Profile
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
selector:
matchLabels:
app: nginx
template:
metadata:
using Common;
using CountryPull;
using Dapr.Client;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
await Host.CreateDefaultBuilder(args).ConfigureServices((context, services) =>
{
@mdmsua
mdmsua / Program.cs
Created January 20, 2020 15:13
EWS Inbox Cleanup
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Exchange.WebServices.Data;
using static Microsoft.Exchange.WebServices.Data.SearchFilter;
namespace Inboxer
{
class MainClass
{
if let library = try? ITLibrary(apiVersion: "1") {
print(library.applicationVersion)
for artist in library.allMediaItems
.filter({ $0.mediaKind == ITLibMediaItemMediaKind.kindSong })
.group(by: { $0.artist?.name }){
print(artist.key)
for album in artist.value.group(by: { $0.album.title }) {
print(" \(album.key) (\(album.value.first!.year))")
}
}
public extension Sequence {
func group<U: Hashable>(by key: (Iterator.Element) -> U?) -> [U:[Iterator.Element]] {
var categories: [U: [Iterator.Element]] = [:]
for element in self {
let key = key(element)
if case nil = categories[key!]?.append(element) {
categories[key!] = [element]
}
}
return categories
curl -s http://nginx.org/keys/nginx_signing.key > /tmp/nginx.key
sudo apt-key add /tmp/nginx.key
rm /tmp/nginx.key
sudo apt-add-repository "deb http://nginx.org/packages/mainline/ubuntu/ xenial nginx"
sudo apt-add-repository "deb-src http://nginx.org/packages/mainline/ubuntu/ xenial nginx"
sudo apt-get update
sudo apt-get install nginx letsencrypt -y
sudo letsencrypt certonly --standalone -d "$DOMAIN" --email "$EMAIL" --agree-tos
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network.target docker.socket
Requires=docker.socket
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
openssl req -x509 -newkey rsa:4096 -keyout certificate.key -out certificate.crt -days 365 [-nodes]