This file contains 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
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 |
This file contains 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
#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. |
This file contains 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
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" |
This file contains 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
cat nmap_scan.txt | grep -B4 open | egrep -o "([0-9]{1,3}\.){3}[0-9]{1,3}" |
This file contains 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
""" | |
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. |
This file contains 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
# 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 file contains 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
/** | |
* 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. | |
* |
This file contains 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
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() |