Skip to content

Instantly share code, notes, and snippets.

View geniuszxy's full-sized avatar
🍋
Focusing

Shingo geniuszxy

🍋
Focusing
View GitHub Profile
@geniuszxy
geniuszxy / rndidgen.cs
Last active November 7, 2018 07:12
Random Id Generator
class IdGenerater
{
private string[] charss = //generated by RandChars
{
"47eRaiGQZHjXPnxh2dfUYbDmN986ycTSvkLuKoJtApWqEMwzFCVr3gs5B",
"6BD28rJaZzqTEjVQsUvNMLfimWG5k94gbK3wyhXPSpxucotHeFCYAdR7n",
"RijAmWYBHtkwJP8K4bgMN5GDFX6zLZsqUhueyEVpdxSa7ocQvTnr32fC9",
"xeuNs75AhUSFkM4TmCZgEtKHDX6QjiG9RvL8opqwadJBcyPYrb3WnzV2f",
"XNQisGdLDSU4Wx2V5PczY8MahpHnuy6j3fvFEAqrTJmRgZk9btw7KBoeC",
"qTmR5btpxP8wGEa6i4zVZurJg7hKysdoMnDFUeX3SCWH2kjc9QfBYNLAv",
@geniuszxy
geniuszxy / AStar
Created May 17, 2019 09:05
Simple astar algorithm ( C# implementation of simplemain/astar )
Simple astar algorithm ( C# implementation of simplemain/astar )
@geniuszxy
geniuszxy / BetterHashSet.cs
Created May 30, 2019 14:57
BetterHashSet
using System;
using System.Collections;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Security.Permissions;
using System.Text;
using System.Diagnostics.CodeAnalysis;
using System.Security;
namespace System.Collections.Generic
@geniuszxy
geniuszxy / QuickSort.cpp
Last active June 17, 2019 06:29
Quick Sort
void Swap(int array[], int a, int b)
{
int tmp = array[a];
array[a] = array[b];
array[b] = tmp;
}
void PrintArray(int array[], int length, int lower, int upper)
{
for (int i = 0; i < length; ++i)
@geniuszxy
geniuszxy / Trie.cs
Last active February 28, 2020 08:11
Efficient trie implemention without multiple dictionaries (or linked lists)
using System;
using System.Collections;
using System.Collections.Generic;
namespace Filter
{
using NodeKey = System.UInt64;
public class Trie
{
@geniuszxy
geniuszxy / CGFontToFontData.m
Created October 24, 2020 04:36 — forked from Bokugene/CGFontToFontData.m
Read Table Data from a CGFont, then wrap them into a OTF/TTF font.
typedef struct FontHeader {
int32_t fVersion;
uint16_t fNumTables;
uint16_t fSearchRange;
uint16_t fEntrySelector;
uint16_t fRangeShift;
}FontHeader;
typedef struct TableEntry {
uint32_t fTag;
@geniuszxy
geniuszxy / EmojiIterator.cs
Last active July 27, 2023 11:26
A simple class iterates over a string that accounts an emoji sequence as a single character.
public class EmojiIterator
{
private string _text;
private int _head, _next;
private int _index, _length;
public EmojiIterator(string text)
{
_text = text;
Reset();
@geniuszxy
geniuszxy / love_orgplayer_thread.lua
Last active July 9, 2021 14:19
An org player written in love
--[[
== Usage ==
1. Get the control channel
ch = love.thread.getChannel('orgplayer')
2. Create a thread and start it
th = love.thread.newThread('love_orgplayer_thread.lua')
th:start()
@geniuszxy
geniuszxy / userChrome.css
Last active February 4, 2022 14:29
Backup of my userChrome.css for firefox
/*** BEGIN Firefox 77 (June 2, 2020) Override URL bar enlargement ***/
/* Compute new position, width, and padding */
#urlbar[breakout][breakout-extend] {
top: 5px !important;
left: 0px !important;
width: 100% !important;
padding: 0px !important;
}
@geniuszxy
geniuszxy / RoundedRectangle.shader
Last active December 30, 2021 06:06
Rounded corner rectangle shader (support different radius for each corner), idea from https://www.shadertoy.com/view/WtdSDs
Shader "Hidden/RoundedRectangle"
{
Properties
{
_MainTex("Texture", 2D) = "white" {}
_Radius("Radius %", Range(0, 0.5)) = 0.2
}
SubShader
{
Tags