Skip to content

Instantly share code, notes, and snippets.

View stevefan1999-personal's full-sized avatar

Steve Fan stevefan1999-personal

View GitHub Profile
@stevefan1999-personal
stevefan1999-personal / biski64.hpp
Created July 31, 2025 02:59
biski64 C++ implementation
struct biski64 {
uint64_t fast_loop{};
uint64_t mix{};
uint64_t loop_mix{};
static constexpr uint64_t splitmix64(uint64_t& x) { // NOLINT
uint64_t z = (x += 0x9e3779b97f4a7c15uLL);
z = (z ^ (z >> 30)) * 0xbf58476d1ce4e5b9uLL;
z = (z ^ (z >> 27)) * 0x94d049bb133111ebuLL;
return z ^ (z >> 31);
@stevefan1999-personal
stevefan1999-personal / app.cs
Created July 26, 2025 04:07
Hot Chocolate + FreeSQL
#!/usr/bin/dotnet run
#:sdk Microsoft.NET.Sdk.Web
#:package HotChocolate.AspNetCore@*
#:package FreeSql@*
#:package FreeSql.Provider.Sqlite@*
#:package FreeSql.Extensions.Linq@*
#:package FreeSql.DbContext@*
#:property TrimMode=partial
@stevefan1999-personal
stevefan1999-personal / why.bash
Created February 28, 2024 07:03
Deny Tailscale to use Cilium as connection gateway
sudo curl https://raw.githubusercontent.com/fernandoenzo/tailgate/master/systemd/tailgate-deny%40.service -o /etc/systemd/system/tailgate-deny\@.service
sudo mkdir -p /etc/systemd/system/tailscaled.service.d/
sudo tee /etc/systemd/system/tailscaled.service.d/override.conf <<EOF
[Unit]
Wants=network-pre.target tailgate-deny@cilium_host.service
EOF
sudo systemctl daemon-reload
sudo systemctl restart tailscaled
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Security.Principal;
using System.Threading.Tasks;
public class SigScanSharp
{
@stevefan1999-personal
stevefan1999-personal / mobx.react.styled-component.coffee
Created September 30, 2017 10:04
what am i doing with my life
import { observer, inject } from 'mobx-react'
import { observable, action } from 'mobx'
import React, { Component } from 'react'
import styled from 'styled-components'
Span = styled.span"""
color: brown;
"""
Title = styled.h1"""
#pragma once
#include <functional> // function
#include <type_traits> // is_same
#include <future> // extra: async
#include <variant> // extra: get, holds_alternative
#include <chrono> // high_resolution_clock, high_resolution_clock::time_point, _seconds
#include <optional>
#include <string>
@stevefan1999-personal
stevefan1999-personal / make_array.hpp
Created September 2, 2017 14:09
(Proof-of-concept) C++17 make_array implementation
template <class T = void, class... Args>
constexpr auto make_array(Args&&... t) {
// T is not void: deduced array type is T
if constexpr (!std::is_same<T, void>()) {
return std::array<T, sizeof...(Args)> { std::forward<Args>(t)... };
}
// T is void: deduced array type is U = std::common_type_t<Args...>
using U = std::common_type_t<Args...>;
// T is void and one of the argument is a specialization of std::reference_wrapper<U>: ill-formed