Skip to content

Instantly share code, notes, and snippets.

@willccbb
willccbb / grpo_demo.py
Last active April 9, 2025 02:11
GRPO Llama-1B
# train_grpo.py
#
# See https://github.com/willccbb/verifiers for ongoing developments
#
import re
import torch
from datasets import load_dataset, Dataset
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import LoraConfig
from trl import GRPOConfig, GRPOTrainer
@cb372
cb372 / riscv.md
Last active April 9, 2025 02:08
Writing an OS in Rust to run on RISC-V

(This is a translation of the original article in Japanese by moratorium08.)

(UPDATE (22/3/2019): Added some corrections provided by the original author.)

Writing your own OS to run on a handmade CPU is a pretty ambitious project, but I've managed to get it working pretty well so I'm going to write some notes about how I did it.

@ChrisCarini
ChrisCarini / Shodan.io Port Usage - US
Last active April 9, 2025 02:07
Shodan.io Port Usage - US
Port 443 │ █████████████████████████████ │ 21270073
Port 80 │ ████████████████████████████▋ │ 21066570
Port 7547 │ ███████████░░░░░░░░░░░░░░░░░░ │ 8116427
Port 22 │ ████████░░░░░░░░░░░░░░░░░░░░░ │ 5890304
Port 4567 │ ███████▎░░░░░░░░░░░░░░░░░░░░░ │ 5371058
Port 161 │ ███▋░░░░░░░░░░░░░░░░░░░░░░░░░ │ 2736796
Port 8080 │ ███▏░░░░░░░░░░░░░░░░░░░░░░░░░ │ 2351805
Port 8443 │ ███▏░░░░░░░░░░░░░░░░░░░░░░░░░ │ 2310328
Port 53 │ ██▌░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 1889449
Port 2087 │ ██▌░░░░░░░░░░░░░░░░░░░░░░░░░░ │ 1876311
@rbsgn
rbsgn / TC agent as a service with Xcode 6.md
Last active April 9, 2025 02:03
TeamCity build agent as a launchd service done right

There are several complaints regarding TeamCity build agent can't run tests in iOS Simulator all gathered in issue TW-38954 Agent started automatically on Yosemite could not launch iOS simulator.

Official workaround from JetBrains found on StackOverflow for this issue looks like this:

$ sh buildAgent/bin/agent.sh start

This means we should convert from automatic launch by launchd to manual via Terminal.app. Side effect of this is no relaunch on agent crash or system reboot.

Further investigation on that issue has led me to the Apple Developer Forums topic where Apple engineer claims following about xcodebuild:

@tjluoma
tjluoma / com.tjluoma.autolock-on-login.plist
Created January 9, 2019 21:31
A 'launchd' plist to automatically lock your Mac as soon as you log in.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.tjluoma.autolock-on-login</string>
<key>ProgramArguments</key>
<array>
<string>/System/Library/CoreServices/Menu Extras/user.menu/Contents/Resources/CGSession</string>
<string>-suspend</string>
@kelvinst
kelvinst / local-gitignore.md
Last active April 9, 2025 02:03
Como fazer um .gitignore local?

Como fazer um .gitignore local?

Bom, este é um recurso, como muitos outros, bem escondido do git. Então resolvi fazer um post para explicar a situação em que pode-se usar e como fazer essa magia negra. 👻

O problema

Você provavelmente já adicionou algum dia um arquivo no projeto que não deveria ser commitado certo? E como você fez para ignorar esse arquivo mesmo? Provavelmente adicionou no arquivo .gitignore.

OK então, aí você commitou esse arquivo .gitignore e pronto, mais ninguém poderá criar um arquivo com o mesmo nome e commitar. Mas espera aí! Não era isso que você queria! Você só queria ignorar esse arquivo na sua máquina, se alguém, algum dia por obséquio achar esse um nome bom para seu arquivo, que assim seja.

@chranderson
chranderson / nvmCommands.js
Last active April 9, 2025 02:02
Useful NVM commands
// check version
node -v || node --version
// list locally installed versions of node
nvm ls
// list remove available versions of node
nvm ls-remote
// install specific version of node
@ruvnet
ruvnet / .roomodes.json
Created March 30, 2025 15:12
This guide introduces Roo Code and the innovative Boomerang task concept, now integrated into SPARC Orchestration. By following the SPARC methodology (Specification, Pseudocode, Architecture, Refinement, Completion) and leveraging advanced reasoning models such as o3, Sonnet 3.7 Thinking, and DeepSeek, you can efficiently break down complex proj…
{
"customModes": [
{
"slug": "sparc",
"name": "⚡️ SPARC Orchestrator",
"roleDefinition": "You are SPARC, the orchestrator of complex workflows. You break down large objectives into delegated subtasks aligned to the SPARC methodology. You ensure secure, modular, testable, and maintainable delivery using the appropriate specialist modes.",
"customInstructions": "Follow SPARC:\n\n1. Specification: Clarify objectives and scope. Never allow hard-coded env vars.\n2. Pseudocode: Request high-level logic with TDD anchors.\n3. Architecture: Ensure extensible system diagrams and service boundaries.\n4. Refinement: Use TDD, debugging, security, and optimization flows.\n5. Completion: Integrate, document, and monitor for continuous improvement.\n\nUse `new_task` to assign:\n- spec-pseudocode\n- architect\n- code\n- tdd\n- debug\n- security-review\n- docs-writer\n- integration\n- post-deployment-monitoring-mode\n- refinement-optimization-mode\n\nValidate:\n✅ Files < 500 lines\n✅ No hard-coded
@fnky
fnky / ANSI.md
Last active April 9, 2025 01:59
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@kartva
kartva / optimizing-purdue-cs.md
Last active April 9, 2025 01:50
Optimizing Purdue CS