Skip to content

Instantly share code, notes, and snippets.

View Camuvingian's full-sized avatar
🎯
Focusing

Nicholas Camus Camuvingian

🎯
Focusing
View GitHub Profile
@jeremygottfried
jeremygottfried / serverReady.js
Created March 4, 2022 19:02
Check if a server is ready in node.js
import http from 'http';
function delay(time) {
return new Promise(((resolve) => {
setTimeout(resolve, time);
}));
}
function serverReady() {
return new Promise(((resolve) => {
@tillig
tillig / Delete-AzureContainerImages.ps1
Created November 5, 2020 16:15
Prunes the set of images in an Azure Container Registry.
<#
.SYNOPSIS
Trims down the set of images in an Azure Container Registry.
.DESCRIPTION
There isn't really a retention policy setting on ACR such that the last X
tags will be retained for a given repository. This script helps bridge that gap by
going through all the repositories in an ACR, selecting the latest X tags to ignore,
then removing tags that were created after that time.
.PARAMETER Registry
The name of the container registry with the images to prune.
@harshitanand
harshitanand / cache.js
Created June 24, 2020 06:14 — forked from lesleh/cache.js
Basic memory cache implementation for JavaScript.
function Cache(config) {
config = config || {};
config.trim = config.trim || 600;
config.ttl = config.ttl || 3600;
var data = {};
var self = this;
var now = function() {
return new Date().getTime() / 1000;
@gregjhogan
gregjhogan / docker-cloudstor-azure-file-share-volume.sh
Created October 31, 2018 20:11
docker cloudstor azure file share volume
# ONLY WORKS FROM INSIDE AZURE !!! (cloudstor can't mount CIFS v3 volumes - required when connecting over internet)
STORAGE_ACCOUNT=<account>
STORAGE_KEY=<key>
STORAGE_SHARE=<share>
# configure
docker plugin install --alias cloudstor:${STORAGE_ACCOUNT} --grant-all-permissions docker4x/cloudstor:18.06.1-ce-azure2 CLOUD_PLATFORM=AZURE AZURE_STORAGE_ACCOUNT_KEY="${STORAGE_KEY}" AZURE_STORAGE_ACCOUNT="${STORAGE_ACCOUNT}" AZURE_STORAGE_ENDPOINT="core.windows.net" DEBUG=1
# create
docker volume create --driver=cloudstor:${STORAGE_ACCOUNT} --opt=share=${STORAGE_SHARE} ${STORAGE_SHARE}
# test
docker run --rm -v ${STORAGE_SHARE}:/data --cap-add SYS_ADMIN --cap-add DAC_READ_SEARCH -it busybox
@nblumhardt
nblumhardt / Program.cs
Last active October 27, 2023 18:39
Enrich.WithCaller()
using System;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using Serilog;
using Serilog.Configuration;
using Serilog.Core;
using Serilog.Events;
namespace ConsoleApp24
@0xjac
0xjac / private_fork.md
Last active May 10, 2024 12:56
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@lesleh
lesleh / cache.js
Last active December 1, 2023 12:21
Basic memory cache implementation for JavaScript.
function Cache(config) {
config = config || {};
config.trim = config.trim || 600;
config.ttl = config.ttl || 3600;
var data = {};
var self = this;
var now = function() {
return new Date().getTime() / 1000;