Skip to content

Instantly share code, notes, and snippets.

using UnityEngine;
namespace Cham
{
/// <summary>
/// ソフトウェアキーボードの表示領域を管理するクラス
/// </summary>
public static class SoftwareKeyboaryArea
{
/// <summary>
@luochen1990
luochen1990 / venv-py37.nix
Last active March 29, 2024 12:18
Nix Script to simulate FHS environment with python3 & pip & venv
#!/usr/bin/env -S bash -c 'nix-shell --pure $0 -A env'
# Usage:
# 1. run directly to enter bash (inside venv): `./venv-py37.nix`
# 2. build a standalone executable: `nix bundle -f ./venv-py37.nix` #this not works yet since it cause nested `unshare -U` call
# 3. run bash with extra arguments: `nix run -f ./venv-py37.nix '' -- -c 'python --version'`
# More:
# 1. commit id of nixpkgs can be found here: https://lazamar.co.uk/nix-versions/?channel=nixpkgs-unstable&package=python3
let
@hallazzang
hallazzang / main.go
Last active March 29, 2024 12:12
[go] (Windows) ensure all child processes are killed when main program exits
package main
import (
"os/exec"
"unsafe"
"golang.org/x/sys/windows"
)
// We use this struct to retreive process handle(which is unexported)
@vratiu
vratiu / .bash_aliases
Last active March 29, 2024 12:11
Git shell coloring
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# SETUP CONSTANTS
# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
# I don't remember where I found this. o_O
# Reset
Color_Off="\[\033[0m\]" # Text Reset
@asci
asci / fetchHighlightsFromAppleBooks.js
Last active March 29, 2024 12:08
Export Highlights from Apple Books
const fs = require("fs");
const sqlite3 = require("sqlite3");
const glob = require("glob");
const os = require("os");
const { open } = require("sqlite");
const username = os.userInfo().username;
const ANNOTATION_DB_PATH = `/users/${username}/Library/Containers/com.apple.iBooksX/Data/Documents/AEAnnotation/`;
const BOOK_DB_PATH = `/users/${username}/Library/Containers/com.apple.iBooksX/Data/Documents/BKLibrary/`;
const annotationsFiles = glob.sync(`${ANNOTATION_DB_PATH}/*.sqlite`);
@ih2502mk
ih2502mk / list.md
Last active March 29, 2024 12:07
Quantopian Lectures Saved
@leilee
leilee / UIView+GradientBorder.swift
Last active March 29, 2024 12:05
Add gradient border to UIView
public extension UIView {
private static let kLayerNameGradientBorder = "GradientBorderLayer"
public func setGradientBorder(
width: CGFloat,
colors: [UIColor],
startPoint: CGPoint = CGPoint(x: 0.5, y: 0),
endPoint: CGPoint = CGPoint(x: 0.5, y: 1)
) {
@jdah
jdah / wfc.hpp
Created August 5, 2022 15:18
Wave Function Collapse
#pragma once
#include "util/types.hpp"
#include "util/std.hpp"
#include "util/ndarray.hpp"
#include "util/collections.hpp"
#include "util/rand.hpp"
#include "util/hash.hpp"
#include "util/assert.hpp"
#include "util/bitset.hpp"
@luke161
luke161 / AddressablesSceneLoader.cs
Last active March 29, 2024 12:02
Handles loading and unloading of Scenes using Unity's Addressable Assets system. Adds support for using LoadSceneParameters when loading a scene, which is currently missing in the official APIs.
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.AddressableAssets.ResourceLocators;
using UnityEngine.ResourceManagement;
using UnityEngine.ResourceManagement.ResourceLocations;
using UnityEngine.ResourceManagement.ResourceProviders;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.SceneManagement;
using System.Collections;
using System.Collections.Generic;