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 / 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
#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 / 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"""
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 / 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