Skip to content

Instantly share code, notes, and snippets.

@codepope
codepope / CSharpTransactions.cs
Last active April 26, 2024 06:55 — forked from RWaltersMA/CSharpTransactions.cs
Updated Example C# code showing MongoDB Transactions using the MongoDB .NET Driver (2.7+)
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
using System;
using System.Threading.Tasks;
namespace MongoDBTransaction
{
public static class Program
{
@ScottHelme
ScottHelme / ballot.md
Last active September 9, 2019 17:45
Ballot SC22: Reduce Certificate Lifetimes

Ballot SC22: Reduce Certificate Lifetimes

Ballot SC22 is valid, quorum has been met, 40 votes cast out of 60 total votes.


Final Status: Ballot Fails

Voting Closed: 18:00 UTC 9th Sep 2019.

@BastianBlokland
BastianBlokland / binserialize.md
Last active November 30, 2023 02:53
Span<byte> based binary serialization
MIT License

Copyright (c) 2019 Bastian Blokland

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@superseb
superseb / restore_rancher2_agents.md
Last active October 10, 2023 06:29
Restore Rancher 2 cluster/node agents on clusters

Restore Rancher 2 cluster/node agents on clusters

This is an unsupported scenario, see rancher/rancher#14731 when there is an official solution.

When cattle-cluster-agent and/or cattle-node-agent are accidentally deleted, or when server-url/cacerts are changed.

Generate definitions

  • Generate API token in the UI (user -> API & Keys) and save the Bearer token
  • Find the clusterid in the Rancher UI (format is c-xxxxx), its in the address bar when the cluster is selected
@chrishanretty
chrishanretty / plot_revoke.R
Created March 21, 2019 12:05
Plot signatures to a petition calling for revocation of Article 50
library(rjson)
library(rio)
library(tidyverse)
library(hrbrthemes)
library(ggrepel)
json_to_df <- function(f) {
json_obj <- tryCatch(fromJSON(file = f),
error = function(e) warning(paste0("No data in ",f)))
@neomantra
neomantra / High_Performance_Redis.md
Last active February 7, 2024 03:41
Notes on running Redis with HPC techniques

High Performance Redis

In response to this brief blog entry, @antirez tweeted for some documentation on high-performance techniques for Redis. What I present here are general high-performance computing (HPC) techniques. The examples are oriented to Redis. but they work well for any program designed to be single- or worker-threaded and asynchronous (e.g. uses epoll).

The motivation for using these techniques is to maximize performance of our system and services. By isolating work, controlling memory, and other tuning, you can achieve significant reduction in latency and increase in throughput.

My perspective comes from the microcosm of my own bare-metal (vs VM), on-premises deployment. It might not be suitable for all scenarios, especially cloud deployments, as I have little experience with HPC there. After some discussion, maybe this can be adapted as [redis.io documentation](https://redis.io/do

/***************************************************************************************************
* FileName: PlatformHelper.cs
* Date: 20180913
* Copyright: Copyright © 2017-2019 Thomas Corwin, et al. All Rights Reserved.
* License: MIT License
**************************************************************************************************/
using System;
using System.IO;
using System.Runtime.InteropServices;
@superseb
superseb / cluster.rkestate_to_kubeconfig.sh
Created January 30, 2019 20:55
cluster.rkestate to kubeconfig
#!/bin/sh
cat cluster.rkestate | jq -r .desiredState.certificatesBundle.\"kube-admin\".config > kubeconfig
@nicebyte
nicebyte / dyn_arr.h
Last active January 23, 2024 00:10
dyn_arr
#pragma once
#define DYN_ARR_OF(type) struct { \
type *data; \
type *endptr; \
uint32_t capacity; \
}
#if !defined(__cplusplus)
#define decltype(x) void*
#!/bin/bash
# DEPRECATED: MOVED TO https://github.com/rancher/logs-collector/blob/master/rancher_logs_collector.sh
# Create temp directory
TMPDIR=$(mktemp -d)
# System info
mkdir -p $TMPDIR/systeminfo
hostname > $TMPDIR/systeminfo/hostname 2>&1
hostname -f > $TMPDIR/systeminfo/hostnamefqdn 2>&1