Skip to content

Instantly share code, notes, and snippets.

View AndriiTsok's full-sized avatar
💡
Creating

Andrii Tsok AndriiTsok

💡
Creating
View GitHub Profile
@ryanto
ryanto / page.tsx
Created August 9, 2023 17:01
<Await> component
import { Markdown } from "@/app/components/markdown";
import { getComments, getPost } from "@/lib/db";
import { Suspense } from "react";
export default async function PostPage({
params,
}: {
params: { postId: string };
}) {
let post = await getPost(params.postId);
@kjmph
kjmph / A_UUID_v7_for_Postgres.sql
Last active July 6, 2024 19:07
Postgres PL/pgSQL function for UUID v7 and a bonus custom UUID v8 to support microsecond precision as well. Read more here: https://datatracker.ietf.org/doc/draft-peabody-dispatch-new-uuid-format/
-- Based off IETF draft, https://datatracker.ietf.org/doc/draft-peabody-dispatch-new-uuid-format/
create or replace function uuid_generate_v7()
returns uuid
as $$
begin
-- use random v4 uuid as starting point (which has the same variant we need)
-- then overlay timestamp
-- then set version 7 by flipping the 2 and 1 bit in the version 4 string
return encode(
@kaqu
kaqu / Parameters.swift
Created February 26, 2020 21:04
Swift dynamic parameters
internal protocol AnyParameter {
var name: String { get }
var optional: Bool { get }
var type: Any.Type { get }
}
public struct Parameter<Value>: AnyParameter {
public var name: String
public var optional: Bool
public var `default`: Value?
@SatoTakeshiX
SatoTakeshiX / convert.swift
Last active June 6, 2024 12:25
Take capture a view by SwiftUI
//
// ContentView.swift
// TryGeometryReader
//
// Created by satoutakeshi on 2019/12/07.
// Copyright © 2019 satoutakeshi. Licensed under MIT.
//
import SwiftUI
@kawsark
kawsark / Vault-ssh-ca-README.md
Created March 28, 2019 16:12
A guide for configuring Vault's SSH-CA

SSH CA use-case with Vault

In this scenario we are going to set up Vault to sign SSH keys using an internal CA. We will configure the SSH secrets engine and create a CA within Vault. We will then configure an SSH server to trust the CA key we just created. Finally we will attempt to SSH using a private key, and a public key signed by Vault SSH CA.

Prerequisites

  • This guide assumes you have already provisioned a Vault server, SSH host using OpenSSH server, and a SSH client machine.
  • The client system must be able to reach the Vault server and the OpenSSH server.
  • We will refer to these systems respectively as:
  • VAULT_SERVER
@brandosha
brandosha / README.md
Last active May 29, 2024 05:21
Real time reflections in SceneKit using Metal

Using the ReflectionSession Class for Real Time Reflections in SceneKit

First, create a new ReflectionSession implementation with your SCNView object. Note: You only need one ReflectionSession object at a time.

let reflectionSession = ReflectionSession(inView: scnView)


Then, add the nodes that you want to be reflective to the ReflectionSession using the addNode(_:roughness:) method. Because .physicallyBased materials won't work, the roughness value will determine how much to blur the cubemap images, simulating a roughness effect.

reflectionSession.addNode(node1)
reflectionSession.addNode(node2, roughness: 0.2)
@korakot
korakot / colab_download.py
Created November 15, 2017 08:40
Google colab file upload/download
files.download('example.txt') # from colab to browser download
@NVentimiglia
NVentimiglia / ItemStack.cs
Last active October 31, 2021 21:06
Need a Items control or a repeater for Xamarin ? Here you go. Bind to observable collections, define your data template and enjoy.
// MIT License
// Nicholas Ventimiglia
// 2016-9-19
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;
@nisrulz
nisrulz / proguard-rules.pro
Created April 5, 2015 06:14
Android : Proguard Rules for a Library Module
#
# This ProGuard configuration file illustrates how to process a program
# library, such that it remains usable as a library.
# Usage:
# java -jar proguard.jar @library.pro
#
# Save the obfuscation mapping to a file, so we can de-obfuscate any stack
# traces later on. Keep a fixed source file attribute and all line number
# tables to get line numbers in the stack traces.