Skip to content

Instantly share code, notes, and snippets.

View vividhsv's full-sized avatar

Vividh S Viswanatha vividhsv

View GitHub Profile
@aw
aw / explain.md
Last active July 29, 2024 12:02
[SOLVED] Proxmox VE and cloud-init snippets etc

Proxmox VE 6.x release includes a feature to add custom cloud-init configs. Unfortunately there is poor documentation, so I had to figure this out by adding pieces of information together.

The custom cloud-init files (user-data, meta-data, network-config)

The cloud-init files need to be stored in a snippet. This is not very well documented:

  1. Go to Storage View -> Storage -> Add -> Directory
  2. Give it an ID such as snippets, and specify any path on your host such as /snippets
  3. Under Content choose Snippets and de-select Disk image (optional)
  4. Upload (scp/rsync/whatever) your user-data, meta-data, network-config files to your proxmox server in /snippets/snippets/ (the directory should be there if you followed steps 1-3)
package main
import (
"flag"
"os"
"time"
"github.com/coding-yogi/goperf/log"
"github.com/coding-yogi/goperf/tests"
)
@richardblondet
richardblondet / FormatUnicorn.js
Created September 17, 2018 13:53
Stack Overflow own formatting function for the String prototype called formatUnicorn. Seen {@link https://stackoverflow.com/questions/610406/javascript-equivalent-to-printf-string-format}
String.prototype.formatUnicorn = String.prototype.formatUnicorn || function () {
"use strict";
var str = this.toString();
if (arguments.length) {
var t = typeof arguments[0];
var key;
var args = ("string" === t || "number" === t) ?
Array.prototype.slice.call(arguments)
: arguments[0];
@1st1
1st1 / example.py
Last active August 1, 2024 15:36
asyncio queues example
import asyncio
import random
import time
async def worker(name, queue):
while True:
# Get a "work item" out of the queue.
sleep_for = await queue.get()
@natesubra
natesubra / rem_proxmox_popup.sh
Created June 26, 2018 13:33 — forked from tavinus/rem_proxmox_popup.sh
Remove PROXMOX 5.2 subscription message popup
#!/bin/sh
#######################################################
#
# Edits the proxmox Subscription file to make it
# think that it has a Subscription.
#
# Will disable the annoying login message about
# missing subscription.
#
@PaulBradley
PaulBradley / deterministic-UUID.md
Last active September 5, 2024 07:24
Generating Deterministic UUID's Within Go #golang

Generating Deterministic UUID's Within Go

I recently worked on a project which needed to interface five hospital systems to one national system. As part of the SOAP submission to the national system I needed to provide a unique UUID which would identify each user from the source hospital system. I wanted to generate the UUID on the fly as the message was being created - so I needed a way to regenerate the same UUID for the same user.

Each hospital system had their own unique user account reference. So by combining this unique account reference with an organisation identifier, I could generate a unique UUID for users with the same account reference across different facilities.

This is the function I came up with. I made use of this package to generate the UUID.

func deterministicGUID(organisation string, account string) string {
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"github.com/gorilla/mux"
"github.com/jinzhu/gorm"
@gbaman
gbaman / graphql_example.py
Created November 1, 2017 00:18
An example on using the Github GraphQL API with Python 3
# An example to get the remaining rate limit using the Github GraphQL API.
import requests
headers = {"Authorization": "Bearer YOUR API KEY"}
def run_query(query): # A simple function to use requests.post to make the API call. Note the json= section.
request = requests.post('https://api.github.com/graphql', json={'query': query}, headers=headers)
if request.status_code == 200:
@alexellis
alexellis / k8s-pi.md
Last active April 11, 2024 14:17
K8s on Raspbian