Skip to content

Instantly share code, notes, and snippets.

@pgrm
pgrm / .p10k.zsh
Last active Aug 20, 2020
powerlevel10k configuration - install https://github.com/romkatv/powerlevel10k and save this file as .p10k.zsh in your home directory to use it
View .p10k.zsh
# Generated by Powerlevel10k configuration wizard on 2020-08-18 at 05:43 CEST.
# Based on romkatv/powerlevel10k/config/p10k-classic.zsh, checksum 46734.
# Wizard options: nerdfont-complete + powerline, small icons, classic, unicode, light,
# 24h time, vertical separators, sharp heads, flat tails, 1 line, compact, many icons,
# concise, instant_prompt=verbose.
# Type `p10k configure` to generate another config.
#
# Config for Powerlevel10k with classic powerline prompt style. Type `p10k configure` to generate
# your own config based on it.
#
@pgrm
pgrm / Profiles.json
Created Aug 20, 2020
Profiles.json from my iTerm2 configuration
View Profiles.json
{
"Profiles": [
{
"Ansi 6 Color" : {
"Green Component" : 0.77254900000000004,
"Blue Component" : 0.99607840000000003,
"Red Component" : 0.77647060000000001
},
"Tags" : [
@pgrm
pgrm / NotSoThreadSafeConsumer.cs
Created Dec 17, 2019
Trying to implement a thread safe wrapper on top of the dotnet kafka consumer to work around the issue describe in https://github.com/confluentinc/confluent-kafka-dotnet/wiki/Client-Creation
View NotSoThreadSafeConsumer.cs
public class MaybeThreadSafeConsumer<TKey, TValue> : IMaybeThreadSafeConsumer<TKey, TValue>
{
private static readonly TimeSpan DefaultLockTimeout = TimeSpan.FromSeconds(5);
private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
private readonly ReaderWriterLock _lock = new ReaderWriterLock();
private readonly IConsumer<TKey, TValue> _internalConsumer;
private readonly ILogger<MaybeThreadSafeConsumer<TKey, TValue>> _logger;
private volatile bool _isActive = true;
View apaleoOne-integration-sampleResponse.json
{
"url": "https://www.example.com",
"expTimestamp": "2019-06-06T12:55:38Z"
}
View apaleoOne-integration-sampleRequestModel.json
{
"code": "AwesomeIntegration",
"label": " My Awesome Reservation Integration",
"iconSource": "https://www.example.com/awesomeicon.png",
"sourceUrl": "https://www.example.com/apaleo/reservations/integration?token=[GUID/JWT]",
"sourceType": "Private",
"propertyIds": [
"AWE",
"SOME"
]
View BrokenBatchDeleteExample.cs
using System.Linq;
using Microsoft.EntityFrameworkCore;
using Z.EntityFramework.Plus;
namespace BrokenBatchDeleteExample
{
class Program
{
public static void Main()
{
@pgrm
pgrm / ghost-blog-ansible-playbook.yaml
Created Aug 26, 2018
Ansible playbook to set up a new ghost blog and update the versions
View ghost-blog-ansible-playbook.yaml
# BEFORE UPDATING, export data from https://YOUR_BLOG/ghost/#/settings/labs
# (PLACEHOLDERS are defined in CAPS_LOCK - replace them with values which make sense to you.)
---
- hosts: HOSTS
vars:
ghost_version: "2.0.3"
ghost_image: "ghost:{{ ghost_version }}-alpine"
ghost_root: "/docker/mounts/GHOST_BLOG"
View new-ubuntu-dev.sh
sudo apt install curl -y
# nodejs
curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
# google chrome
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
# dotnet core
@pgrm
pgrm / powershell-init.ps1
Last active Dec 3, 2017
A set of useful powershell extensions
View powershell-init.ps1
# Execution policy - https://technet.microsoft.com/en-us/library/ee176961.aspx
# Get PS Get (http://psget.net/)
(new-object Net.WebClient).DownloadString("http://psget.net/GetPsGet.ps1") | iex
import-module PsGet
# Usful modules
# http://psget.net/directory/Jump.Location/
Install-Module Jump.Location
You can’t perform that action at this time.