Skip to content

Instantly share code, notes, and snippets.

View PrimeDominus's full-sized avatar

Dominus Prime PrimeDominus

  • Melbourne, Australia
View GitHub Profile
@adamency
adamency / Move Kubernetes Resource to other Namespace
Last active July 6, 2024 13:12
Move Kubernetes Resource from one namespace to another
kubectl get -n <old_namespace> <kind> <resource> -o json |\
jq '.metadata.namespace = "<new_namespace>"' |\
kubectl create -f - &&\
kubectl delete -n <old_namespace> <kind> <resource>
@enricofoltran
enricofoltran / main.go
Last active October 3, 2024 14:08
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@judy2k
judy2k / parse_dotenv.bash
Created March 22, 2017 13:34
Parse a .env (dotenv) file directly using BASH
# Pass the env-vars to MYCOMMAND
eval $(egrep -v '^#' .env | xargs) MYCOMMAND
# … or ...
# Export the vars in .env into your shell:
export $(egrep -v '^#' .env | xargs)
@steinwaywhw
steinwaywhw / One Liner to Download the Latest Release from Github Repo.md
Last active November 3, 2024 22:54
One Liner to Download the Latest Release from Github Repo
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
@Blastman
Blastman / DtoTest.CreateObject.java
Last active April 19, 2022 06:40
Testing DTOs and Transfer Objects
/**
* Creates an object for the given {@link Class}.
*
* @param fieldName The name of the field.
* @param clazz The {@link Class} type to create.
*
* @return A new instance for the given {@link Class}.
*
* @throws InstantiationException If this Class represents an abstract class, an interface, an array class, a
* primitive type, or void; or if the class has no nullary constructor; or if the instantiation fails
@lolzballs
lolzballs / HelloWorld.java
Created March 22, 2015 00:21
Hello World Enterprise Edition
import java.io.FileDescriptor;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
public class HelloWorld{
private static HelloWorld instance;
public static void main(String[] args){
instantiateHelloWorldMainClassAndRun();
@wadewegner
wadewegner / addselftosqlsysadmin.cmd
Created January 25, 2012 18:35
Script to add the current user to the sysadmin role in SQL Server
@echo off
rem
rem ****************************************************************************
rem
rem Copyright (c) Microsoft Corporation. All rights reserved.
rem This code is licensed under the Microsoft Public License.
rem THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
rem ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
rem IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
rem PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.