Skip to content

Instantly share code, notes, and snippets.

@Karlheinzniebuhr
Karlheinzniebuhr / cursor-prompt.txt
Created May 23, 2025 19:49 — forked from avilum/cursor-prompt.txt
Cursor prompt template 07/04/2025
[V1]
You are a powerful agentic AI coding assistant, powered by [Claude 3.7 Sonnet]. You operate exclusively in Cursor, the world's best IDE.
Your main goal is to follow the USER's instructions at each message.
# Additional context
Each time the USER sends a message, we may automatically attach some information about their current state, such as what files they have open, where their cursor is, recently viewed files, edit history in their session so far, linter errors, and more.
Some information may be summarized or truncated.
This information may or may not be relevant to the coding task, it is up for you to decide.
Top 1 Results for Facet: has_screenshot
1 24
@Karlheinzniebuhr
Karlheinzniebuhr / gist:967ed03b30de0937d25a2a2ce3d039b0
Last active March 14, 2024 21:27
Simulation of individual vs Shared portfolio
import random
import matplotlib.pyplot as plt
# Adjusted simulation settings
trading_days = 30 # Half a year
individual_portfolios = [1000, 1000, 1000, 1000]
shared_portfolio = 1000
win_rate = 0.75 # 50% win rate
# New risk-reward settings
@Karlheinzniebuhr
Karlheinzniebuhr / gist:0e996d986ae99f7feb13f7af5b9eb3af
Last active March 31, 2022 05:06
Convert Windows Path to Windows Subsystem for Linux Path with AutoHotKey
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
^+F1:: ; Ctrl+Shift+F1 (/)
;Empty the Clipboard.
Clipboard =
;Copy the select text to the Clipboard.
@Karlheinzniebuhr
Karlheinzniebuhr / data.table-joins.R
Created July 19, 2020 21:51 — forked from nacnudus/data.table-joins.R
How to do joins with data.table
library(data.table)
?`[.data.table`
DT <- data.table(x=rep(c("b","a","c"),each=3), y=c(1,3,6), v=1:9)
X <- data.table(x=c("c","b"), v=8:7, foo=c(4,2))
colnames(DT)
# [1] "x" "y" "v"
@Karlheinzniebuhr
Karlheinzniebuhr / Grep IPs with open ports.txt
Created September 14, 2018 13:13
Grep all IPs with open ports from nmap output txt
cat nmap_scan.txt | grep -B4 open | egrep -o "([0-9]{1,3}\.){3}[0-9]{1,3}"
"""
Given the starting point of any `x` gradient descent
should be able to find the minimum value of x for the
cost function `f` defined below.
"""
import random
def f(x):
"""
Quadratic function.
@Karlheinzniebuhr
Karlheinzniebuhr / linear_regression.py
Created June 8, 2017 13:28
Linear regression with gradient descent
# How to Do Linear Regression using Gradient Descent
# import Numpy, THE matrix multiplication library for python
from numpy import *
# minimize the "sum of squared errors". This is how we calculate and correct our error
def compute_error_for_line_given_points(b, m, points):
totalError = 0
for i in range(0, len(points)):
x = points[i, 0]
/**
* This Google Sheets script keeps data in the specified column sorted any time
* the data changes.
*
* After much research, there wasn't an easy way to automatically keep a column
* sorted in Google Sheets, and creating a second sheet to act as a "view" to
* my primary one in order to achieve that was not an option. Instead, I
* created a script that watches for when a cell is edited and triggers
* an auto sort.
*
import random
text_file = open("randomwordlist.txt", "w")
for i in range(100000000):
text_file.write(str(random.randint(1, 1000000))+"\n")
text_file.close()