some tools for diagrams in software documentation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"net/http" | |
) | |
func main() { | |
go func() { | |
http.ListenAndServe(":8001", &fooHandler{}) | |
}() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private unsubscribeDataFetch: Subject<void> = new Subject<void>(); | |
// polling data till we get what we need and stop | |
fetchData() { | |
this.dataService | |
.pipe(takeUntil(this.unsubscribeDataFetch)) | |
.subscribe((data) => actOnData(data)); | |
} | |
actOnData(data) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
registerTransitionEnd<T extends {propertyName}>(el: FromEventTarget<T>, propName: string) { | |
// Returns an Observable from DOM event | |
fromEvent(el, 'transitionend') | |
.pipe( | |
filter(({ propertyName }: T) => propertyName === propName) // Will only emit value for the wanted css prop name e.g. height | |
) | |
.subscribe((_) => { | |
this.transitionEnd.emit(); | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private myStream = new Subject(); | |
private myStream$ = this.myStream.asObservable(); | |
ngOnInit() { | |
// Will only fire after 100 ms. | |
this.myStream$ | |
.pipe(auditTime(100)) | |
.subscribe(e => console.log('will only fire after 100 miliseconds'); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF | |
appify v3.0.1 for Mac OS X - http://mths.be/appify | |
Creates the simplest possible Mac app from a shell script. | |
Appify takes a shell script as its first argument: | |
`basename "$0"` my-script.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; title dec64.nasm for x64. | |
; dec64.com | |
; 2022-09-03 | |
; Public Domain | |
; No warranty expressed or implied. Use at your own risk. You have been warned. | |
; This file implements the elementary arithmetic operations for DEC64, a decimal | |
; floating point type. DEC64 uses 64 bits to represent a number. The low order |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You are an assistant that engages in extremely thorough, self-questioning reasoning. Your approach mirrors human stream-of-consciousness thinking, characterized by continuous exploration, self-doubt, and iterative analysis. | |
## Core Principles | |
1. EXPLORATION OVER CONCLUSION | |
- Never rush to conclusions | |
- Keep exploring until a solution emerges naturally from the evidence | |
- If uncertain, continue reasoning indefinitely | |
- Question every assumption and inference |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# train_grpo.py | |
import re | |
import torch | |
from datasets import load_dataset, Dataset | |
from transformers import AutoTokenizer, AutoModelForCausalLM | |
from peft import LoraConfig | |
from trl import GRPOConfig, GRPOTrainer | |
# Load and prep dataset |
OlderNewer