Skip to content

Instantly share code, notes, and snippets.

View op8867555's full-sized avatar

Alex Lu op8867555

  • Taipei, Taiwan
View GitHub Profile
@slimsag
slimsag / ramblings.md
Last active December 13, 2023 08:02
Because cross-compiling binaries for Windows is easier than building natively

Because cross-compiling binaries for Windows is easier than building natively

I want Microsoft to do better, want Windows to be a decent development platform-and yet, I constantly see Microsoft playing the open source game: advertising how open-source and developer friendly they are - only to crush developers under the heel of the corporate behemoth's boot.

The people who work at Microsoft are amazing, kind, talented individuals. This is aimed at the company's leadership, who I feel has on many occassions crushed myself and other developers under. It's a plea for help.

The source of truth for the 'open source' C#, C++, Rust, and other Windows SDKs is proprietary

You probably haven't heard of it before, but if you've ever used win32 API bindings in C#, C++, Rust, or other languages, odds are they were generated from a repository called microsoft/win32metadata.

use std::time::Duration;
pub use OpF::*;
// Simple operation, with open recursion
#[derive(Debug, Clone)]
pub enum OpF<R> {
Once(String, Duration),
Par(Vec<R>),
Seq(Vec<R>),
Repeat { times: u32, cmd: Box<R> },
@ZipFile
ZipFile / README.md
Last active June 26, 2024 02:19
Pixiv OAuth Flow

Retrieving Auth Token

  1. Run the command:

    python pixiv_auth.py login

    This will open the browser with Pixiv login page.

@snoyberg
snoyberg / abonimable-snoyman.rs
Created December 2, 2020 15:05
Playing with GATs, transformers, and more
#![feature(generic_associated_types)]
#[allow(dead_code)]
trait Functor {
type Unwrapped;
type Wrapped<B>: Functor;
fn map<F, B>(self, f: F) -> Self::Wrapped<B>
where
F: FnMut(Self::Unwrapped) -> B;
@tarleb
tarleb / sidenote.lua
Last active October 30, 2021 12:50
Reimplementation of pandoc-sitenote by @jez as Lua filter
local counter = 0
function make_label(nonu)
local label_class = 'margin-toggle' .. (nonu and '' or ' sidenote-number')
local label_sym = nonu and '&#8853;' or ''
local label_html = string.format(
'<label for="sn-%d" class="%s">%s</label>',
counter,
label_class,
label_sym
@edmundsmith
edmundsmith / writeup.md
Created July 7, 2019 20:47
Method for Emulating Higher-Kinded Types in Rust

Method for Emulating Higher-Kinded Types in Rust

Intro

I've been fiddling about with an idea lately, looking at how higher-kinded types can be represented in such a way that we can reason with them in Rust here and now, without having to wait a couple years for what would be a significant change to the language and compiler.

There have been multiple discussions on introducing higher-ranked polymorphism into Rust, using Haskell-style Higher-Kinded Types (HKTs) or Scala-looking Generalised Associated Types (GATs). The benefit of higher-ranked polymorphism is to allow higher-level, richer abstractions and pattern expression than just the rank-1 polymorphism we have today.

As an example, currently we can express this type:

@munificent
munificent / generate.c
Last active May 14, 2024 05:30
A random dungeon generator that fits on a business card
#include <time.h> // Robert Nystrom
#include <stdio.h> // @munificentbob
#include <stdlib.h> // for Ginny
#define r return // 2008-2019
#define l(a, b, c, d) for (i y=a;y\
<b; y++) for (int x = c; x < d; x++)
typedef int i;const i H=40;const i W
=80;i m[40][80];i g(i x){r rand()%x;
}void cave(i s){i w=g(10)+5;i h=g(6)
+3;i t=g(W-w-2)+1;i u=g(H-h-2)+1;l(u
//
// Author: Jonathan Blow
// Version: 1
// Date: 31 August, 2018
//
// This code is released under the MIT license, which you can find at
//
// https://opensource.org/licenses/MIT
//
//
@bforte
bforte / RISBF.hs
Created July 18, 2018 22:00
RISBF implementation.
{-# LANGUAGE FlexibleContexts, GeneralizedNewtypeDeriving, LambdaCase,
NoMonomorphismRestriction, TemplateHaskell #-}
{-|
Module : Main
Description : RISBF implementation
Copyright : (c) BMO 2018
License : MIT (see https://opensource.org/licenses/MIT)
@tadly
tadly / rofi-emoji.sh
Last active June 14, 2024 16:40
Rofi emoji picker
#!/usr/bin/env bash
#
# Use rofi to pick emoji because that's what this
# century is about apparently...
#
# Requirements:
# rofi, xsel, xdotool, curl, xmllint
#
# Usage:
# 1. Download all emoji