Skip to content

Instantly share code, notes, and snippets.

View GZGavinZhao's full-sized avatar
☯️
See chart in profile for indications of availability.

Gavin Zhao GZGavinZhao

☯️
See chart in profile for indications of availability.
  • 03:33 (UTC -04:00)
View GitHub Profile
@GZGavinZhao
GZGavinZhao / process.md
Last active April 17, 2024 04:46
Example cycles breaking workflow with autobuild

autobuild commit: c41630ce9ff6fe516f6e09be055b7ab01d0795d2

getsolus/packages commit: d10fd470f2bdf13ff938fb934c85e711c8fac678

In general, a dependency can be ignored when solving build order if any of the following satisfies:

  • It's only for testing.
  • It's only for generating documentation.
  • It's only a rundep. This is a little special, because in general we want to keep the rundep information as much as possible, so we should only ignore a
@GZGavinZhao
GZGavinZhao / repro.dart
Created January 3, 2024 21:36
angular#69
import 'dart:async';
import 'dart:html' as html;
import 'dart:js_util';
import 'dart:math';
import 'package:js/js.dart';
import 'package:ngdart/angular.dart';
import 'package:rava_frontend/src/shared/directives/value_accessors/custom_form_directives.dart';
// ignore: unused_import
import 'package:rava_frontend/src/shared/js_interop/bootstrap_interop.dart';
@GZGavinZhao
GZGavinZhao / main.go
Created December 4, 2023 21:20
Bump release number of a package.yml file.
package main
import (
"bufio"
"bytes"
"fmt"
"os"
"strconv"
"gopkg.in/yaml.v3"
@GZGavinZhao
GZGavinZhao / single-commit-clone.d
Created July 6, 2023 00:20
Clone any repo at a particular commit, written in D
module main;
import std.range;
import std.array;
import std.algorithm;
import std.string;
import std.stdio;
import std.format;
import std.conv;
import std.path;
@GZGavinZhao
GZGavinZhao / oienv.nix
Created February 10, 2023 02:59
My OI environment
# Nix下的OI环境,主要是为了Haskell
let
# 万一以后需要呢
config = { allowUnfree = true; };
pkgs = import <nixpkgs> { inherit config; };
in {
# Base
@GZGavinZhao
GZGavinZhao / baskit.d
Created December 26, 2022 14:44
Build order determination for boulder.
import std.stdio, std.array, std.container, std.string, std.file, std.conv, std.algorithm, std.parallelism, std.path;
import moss.deps.dependency;
import moss.format.binary.reader;
import moss.format.binary.payload;
import moss.format.binary.payload.meta;
import moss.format.binary.payload.meta.record_pair;
import moss.format.binary.payload.layout;
void mkuniq(T)(ref T[] arr)
{
@GZGavinZhao
GZGavinZhao / main.dart
Created September 2, 2022 01:11
NativeFinalizer work around to free pointers in a guaranteed way without ANY native code
import 'dart:ffi';
import 'package:ffi/ffi.dart';
void main(List<String> arguments) {
print('Opening the executable...');
final lib = DynamicLibrary.executable();
print('Grabbing `free` function from myself...');
final free = lib.lookupFunction<Void Function(Pointer), void Function(Pointer)>('free');
const String test = "Hello World!";
@GZGavinZhao
GZGavinZhao / getchar.dart
Created March 20, 2022 00:30
Fast I/O for competitive programming in Dart by calling getchar() in C.
import 'dart:ffi' as ffi;
typedef getchar_func = ffi.Int8 Function();
final dylib = ffi.DynamicLibrary.open("/usr/lib/libstdc++.so");
final int Function() getChar =
dylib.lookup<ffi.NativeFunction<getchar_func>>('getchar').asFunction();
void main() {
int input = getChar();
// There's no `char` in Dart. Use the following to convert your ASCII value
@GZGavinZhao
GZGavinZhao / null_coverage.dart
Last active October 5, 2021 16:21
Detect how many files have been migrated to NNBD in a Dart project.
import 'dart:io';
import 'dart:convert';
import 'package:path/path.dart' as p;
main(List<String> args) async {
print('Counting number of Dart files...');
var count = 0;
await Directory('lib').list(recursive: true).forEach((element) {
if (element is File && p.extension(element.path) == '.dart') {
@GZGavinZhao
GZGavinZhao / install-node.sh
Created August 24, 2021 00:59
Install nodejs on M1 Mac without sudo
#!/bin/sh
mkdir -p $HOME/SDK/
curl -o node.tar.gz -L https://nodejs.org/dist/v16.7.0/node-v16.7.0-darwin-arm64.tar.gz
tar -xf node.tar.gz -C $HOME/SDK && rm -rf node.tar.gz
mv node-v16.7.0-darwin-arm64 node
echo "export PATH=$PATH:$HOME/SDK/node/bin" >> $HOME/.zshrc
source $HOME/.zshrc
node --version