Skip to content

Instantly share code, notes, and snippets.

View 0xF6's full-sized avatar
🧬

Yuuki Wesp 0xF6

🧬
View GitHub Profile
var rarity = new [] { 5000, 2000, 1000, 500, 100 };
int[] dispenser_action(int sum)
{
if (sum % rarity.OrderBy(x => x).First() != 0)
throw new Exception();
var result = new List<int>();
foreach (var r in rarity)
{
var x = (sum - (sum % r)) / r;
result.AddRange(Enumerable.Range(0, x).Select(_ => r));
enum
{
NOP,
ADD
};
struct thestack {
union {
int i;
@0xF6
0xF6 / auto_craft.ahk
Created January 29, 2021 10:32
Cyberpunk 2077 auto craft script
#MaxThreadsPerHotkey 3
F1::
Toggle := !Toggle
Loop
{
If (!Toggle)
Break
Click down
Sleep 850
@0xF6
0xF6 / method.regex
Created January 23, 2021 19:40
rex for method declaration
(?x)
(?<return-type>
(?<type-name>
(?:
(?:ref\s+(?:readonly\s+)?)?
(?:
(?:(?<identifier>@?[_[:alpha:]][_[:alnum:]]*)\s*\:\:\s*)?
(?<name-and-type-args>
\g<identifier>\s*
(?<type-args>\s*<(?:[^<>]|\g<type-args>)+>\s*)?
@0xF6
0xF6 / AdBannerSafeRegion.cs
Last active November 2, 2020 19:31
Apply a safe region calculation using classic ad banner.
/// <summary>
/// Only <see cref="BannerPosition.BOTTOM_*"/>
/// </summary>
public static void ApplyAdsSafeRegion(this RectTransform target, Rect safeRegion)
{
static float getAdHeight() =>
((Screen.height / (Screen.dpi / 160f)) > 720f) ? 90f * (Screen.dpi / 160f)
: ((Screen.height / (Screen.dpi / 160f)) > 400f) ? 50f * (Screen.dpi / 160f)
: 32f * (Screen.dpi / 160f);
r.y += getAdHeight();
@0xF6
0xF6 / fn_name.h
Created September 17, 2020 15:50
#pragma once
#if defined(__GNUC__) || (defined(__ICC) && (__ICC >= 600))
#define G_FUNCTION_NAME __PRETTY_FUNCTION__
#elif defined(__FUNCSIG__)
#define G_FUNCTION_NAME __FUNCSIG__
#elif (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 600))
#define G_FUNCTION_NAME __FUNCTION__
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)
#define G_FUNCTION_NAME __func__
@0xF6
0xF6 / bgd.csx
Created July 9, 2020 13:06
BigInt divide
double Divide(BigInteger x, BigInteger y)
=> Math.Exp(BigInteger.Log(x) - BigInteger.Log(y));
@0xF6
0xF6 / Driver_CO2.cpp
Created January 29, 2020 22:51
Display CO2 ppm value contains in air.
#include "Arduino.h"
#include "TM74.h"
#define DIO 5
#define RCLK 6
#define SCLK 7
#define ALARM 10
TM74 display(SCLK, RCLK, DIO);
HTML 14 mins ████████████████▌░░░░ 79.0%
JSON 3 mins ████▍░░░░░░░░░░░░░░░░ 20.9%
Other 0 secs ░░░░░░░░░░░░░░░░░░░░░ 0.1%
Git Config 0 secs ░░░░░░░░░░░░░░░░░░░░░ 0.1%

Keybase proof

I hereby claim:

  • I am 0xf6 on github.
  • I am ivysola (https://keybase.io/ivysola) on keybase.
  • I have a public key ASCfQSPaCC6X4o6E4p_PVTgzGYygbGE5UjriKcaP_1qhNgo

To claim this, I am signing this object: