Skip to content

Instantly share code, notes, and snippets.

View BennyKok's full-sized avatar
😋
Vibe with me

BennyKok BennyKok

😋
Vibe with me
View GitHub Profile
@BennyKok
BennyKok / 3d-pack.py
Created July 30, 2024 20:54
3d pack on modal
import json
import subprocess
import uuid
from pathlib import Path
from typing import Dict
import asyncio
import aiohttp
import modal
# Time to wait between API check attempts in milliseconds
@BennyKok
BennyKok / handleGithubDeviceFlow.js
Created August 27, 2023 16:38
A nodejs cli function for getting user auth token using device flow.
async function handleGithubDeviceFlow(clientId) {
const a = await fetch("https://github.com/login/device/code", {
method: "POST",
body: JSON.stringify({
client_id: clientId,
scope: "user",
}),
headers: {
Accept: "application/json",
"Content-Type": "application/json",
import useSWR from 'swr';
const fetcher = (url: string) => fetch(url).then((res) => res.json());
function NpmPackageInstaller({
name,
}: {
name: string;
}) {
const { data, error } = useSWR(`https://registry.npmjs.org/${name}`, fetcher);
//visible[0] is an AnimBool, you can cache it somewhere in your custom editor.
using (new EditorUtils.FoldoutScope(visible[0], out var shouldDraw, "SongItem"))
{
if (shouldDraw)
{
//draw the rest of your GUI.
songItem = EditorGUILayout.ObjectField(songItem, typeof(SongItem), false) as SongItem;
}
}
@BennyKok
BennyKok / HiddenComponentViewer.cs
Last active July 27, 2020 11:32
A simple editor which reveal hidden component, and lets you delete it.
using UnityEditor;
using UnityEngine;
public class HiddenComponentViewer : EditorWindow
{
[MenuItem("Tools/HiddenComponentViewer")]
private static void ShowWindow()
{
var window = GetWindow<HiddenComponentViewer>();
@BennyKok
BennyKok / AddWorkspaceItemsTask.java
Last active October 3, 2018 02:14
CarbonHome all apps override
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software