Skip to content

Instantly share code, notes, and snippets.

View tonidy's full-sized avatar

toni dy tonidy

View GitHub Profile
@arno01
arno01 / docker-on-android.md
Last active June 29, 2025 16:39
Docker on Android

WORK IN PROGRESS

Docker on Android

Setup:

Samsung Galaxy Tab S5e SM-T720
Android Pie on Linux 4.9.112 (not rooted)
Termux
@phillippelevidad
phillippelevidad / InjectionFixture.cs
Created March 27, 2019 20:11
xUnit: add Startup to test project and reuse configurations
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;
using System;
using System.Net.Http;
namespace Tests
{
public class InjectionFixture : IDisposable
{
private readonly TestServer server;
// This file is based on the code from the ASP.NET Core repository
// https://github.com/aspnet/AspNetCore/tree/master/src/Middleware/SpaServices.Extensions/src
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net;
@hashamali
hashamali / main.go
Created January 19, 2019 03:36
Use UUID with GORM.
package main
import (
"fmt"
"log"
"time"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/sqlite"
"github.com/satori/go.uuid"
@arichika
arichika / EnableSystemVersionedTemporalTables.cs
Last active July 12, 2021 19:10
Entity Framework Core (EFCore) Enable System-Versioned Temporal Table with Code First
namespace EFCoreEnableSystemVersionedTemporalTables
{
public static class EnableSystemVersionedTemporalTables
{
private static readonly (string SysStartTimeString, string SysEndTimeString) TemporalTableAdditionalFileds = (SysStartTimeString: "SysStartTime", SysEndTimeString: "SysEndTime");
public static void AddAsSystemVersionedTemporalTable(this MigrationBuilder migrationBuilder, string tableName, string temporalScheme = null, string temporalTableSuffix = @"History")
{
var temporalTableName = $"{tableName}{temporalTableSuffix}";
var schemaName = temporalScheme ?? "dbo";
@lagivan
lagivan / postman2confluence.py
Last active March 5, 2025 01:12 — forked from sreesarma/postman2confluence.py
Generate Wiki-formatted API Documentation from Postman Collections
# Run with full path to postman collection file as a single parameter, in Postman 2.1 format
# See "Postman to Wiki" at https://medium.com/@sreedharc/postman-to-wiki-e7d31c76db57 for more information
# Generates Markdown for Confluence Wiki from a given Collection file exported from Postman per Collections 2.1 schema
import json
import sys
import os
import re
from operator import itemgetter
from itertools import groupby
@DaveKin
DaveKin / json_uniq.sql
Last active October 16, 2024 22:01
SQL function to remove duplicate entries from a JSON array. Based on MYSQL 5.7+
CREATE FUNCTION JSON_UNIQ(arr JSON) RETURNS json
BEGIN
SET @arr = arr;
SET @a_length = JSON_LENGTH(@arr);
SET @loop_index = @a_length;
WHILE @loop_index >= 0 DO
SET @item = JSON_UNQUOTE(JSON_EXTRACT(@arr, concat('$[',@loop_index,']')));
@sreesarma
sreesarma / postman2confluence.py
Last active September 19, 2022 06:57
Generate Wiki-formatted API Documentation from Postman Collections
# See "Postman to Wiki" at https://medium.com/@sreedharc/postman-to-wiki-e7d31c76db57 for more information
# Generates Markdown for Confluence Wiki from a given Collection file exported from Postman per Collections 2.1 schema
# Change working_dir and input_file to suit, then run it
import json
from operator import itemgetter
from itertools import groupby
# A postman collection, in Postman 2.1 format
root = "/tmp/ctrd/var/lib/containerd"
state = "/tmp/ctrd/run/containerd"
oom_score = 0
[grpc]
address = "/tmp/ctrd/run/containerd/containerd.sock"
uid = 501
gid = 0
max_recv_message_size = 0
max_send_message_size = 0
@eruffaldi
eruffaldi / gettoken.sh
Created September 25, 2018 09:23
Google OAuth 2.0 full example bash script.
#!/bin/bash
#1) on https://console.developers.google.com/ register project and associate API from library
# OUTPUT: client_id,client_secret
client_id="..."
client_secret="...."
#2) get authorization code at the following link using web browser
# OUTPUT: code
scope="https://www.googleapis.com/auth/drive"