Skip to content

Instantly share code, notes, and snippets.

View cip8's full-sized avatar
๐Ÿ‘‹

Ciprian Cimpan cip8

๐Ÿ‘‹
View GitHub Profile

Keybase proof

I hereby claim:

  • I am ciprian-cimpan on github.
  • I am ciprian42 (https://keybase.io/ciprian42) on keybase.
  • I have a public key ASAFJVuXrpaYfsFfCKnC-2Bg9Hn1SA0HbI5_u1BkwRzOdwo

To claim this, I am signing this object:

@cip8
cip8 / IPv4-IPv6-domain-regex.go
Created October 19, 2022 19:21 — forked from ahmetozer/IPv4-IPv6-domain-regex.go
Ipv4 - IPv6 - domain Regex Golang
ipv6_regex := `^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$`
ipv4_regex := `^(((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4})`
domain_regex := `^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$`
match, _ := regexp.MatchString(ipv4_regex+`|`+ipv6_regex+`|`+domain_regex, host)
if match {
fmt.Println("Input is valid")
} else {
fmt.Println("Given input does not match")
re
@cip8
cip8 / Docker-Compose-As-Service.md
Last active November 30, 2022 10:11 — forked from Luzifer/README.md
Running docker-compose as a systemd service

Running docker-compose as a systemd service

Files

File Purpose
/etc/compose/docker-compose.yml Compose file describing what to deploy
/etc/systemd/system/docker-compose-reload.service Executing unit to trigger reload on docker-compose.service
/etc/systemd/system/docker-compose-reload.timer Timer unit to plan the reloads
/etc/systemd/system/docker-compose.service Service unit to start and manage docker compose
def get_grid_points(self, mask_arr: np.ndarray, pad_ratio: int = 50) -> np.ndarray:
"""
Returns a grid of points that are in the foreground of the given binary mask.
The padding between points in the grid is adjusted based on the size of the mask.
Parameters:
- mask: A 2D binary numpy array, where 1 represents foreground and 0 represents background.
- pad_ratio: Scaling factor (divisor) used to compute the padding between points in the grid. Larger values result in smaller padding.
@cip8
cip8 / Tutorial: GEPA for Quantitative Trading Strategies.md
Created October 7, 2025 22:28 — forked from jmanhype/Tutorial: GEPA for Quantitative Trading Strategies.md
Tutorial demonstrating GEPA optimization for quantitative trading strategies with DSPy

Tutorial: GEPA for Quantitative Trading Strategies

In this tutorial, we optimize GPT-4.1 Mini's Chain of Thought (dspy.ChainOfThought) for generating profitable trading strategies using the dspy.GEPA optimizer! We demonstrate how to evolve prompts for different strategy themes (momentum, mean reversion, breakout, arbitrage, volume) with proper risk management.

The Vision: Autonomous Trading Research with Theme Specialization

This implementation realizes Kagen Atkinson's vision of an autonomous LLM-powered trading system with:

  • Theme-based Specialization: --theme flag for different strategy types (as Kagen intended)
  • Offline Research Loop (test_gepa_enhanced.py): GEPA evolves theme-specific prompts through reflective optimization
  • Deterministic Execution (run_gepa_trading.py): Uses evolved prompts for strategy generation and backtesting