Skip to content

Instantly share code, notes, and snippets.

View PatrickRudgeri's full-sized avatar
🌴
On vacation

Patrick Rudgeri PatrickRudgeri

🌴
On vacation
  • Brazil
View GitHub Profile
Results=pd.DataFrame([])
sns.set(font_scale=1.2)
for i in matrix:
results1=pd.read_csv('Results'+str(i)+'.csv')
Positive_Fees=(i[0]+100)*0.00075+100*0.00075
Negative_Fees=(i[1]+100)*0.00075+100*0.00075
No_Outcome_Fees=200*0.00075
results1['Return']=(i[0]-Positive_Fees)*results1['Success rate']*results1['Quantity']+(i[1]-Positive_Fees)*(results1['Quantity']-results1['Success rate']*results1['Quantity'])+((i[0]+i[1])/7-No_Outcome_Fees)*results1['Quantity']*results1['no_outcome']
results1['Combination']=str(i[0])+', '+str(i[1])
results1.drop(results1.columns[0],inplace=True,axis=1)
@kensoh
kensoh / TagUI for Python Draft.md
Last active December 25, 2020 19:57
TagUI for Python Draft.md
@siddharthpaliwal
siddharthpaliwal / Calling C++ functions from python
Last active November 6, 2020 21:07
Calling C++ functions from python
Calling C++ functions from python
@gocarlos
gocarlos / Eigen Cheat sheet
Last active September 10, 2024 02:31
Cheat sheet for the linear algebra library Eigen: http://eigen.tuxfamily.org/
// A simple quickref for Eigen. Add anything that's missing.
// Main author: Keir Mierle
#include <Eigen/Dense>
Matrix<double, 3, 3> A; // Fixed rows and cols. Same as Matrix3d.
Matrix<double, 3, Dynamic> B; // Fixed rows, dynamic cols.
Matrix<double, Dynamic, Dynamic> C; // Full dynamic. Same as MatrixXd.
Matrix<double, 3, 3, RowMajor> E; // Row major; default is column-major.
Matrix3f P, Q, R; // 3x3 float matrix.
@wojteklu
wojteklu / clean_code.md
Last active September 21, 2024 05:38
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@hugobowne
hugobowne / tweet_listener.py
Last active October 6, 2023 18:48
NOTE: this code is for a previous version of the Twitter API and I will not be updating in the near future. If someone else would like to, I'd welcome that! Feel free to ping me. END NOTE. Here I define a Tweet listener that creates a file called 'tweets.txt', collects streaming tweets as .jsons and writes them to the file 'tweets.txt'; once 100…
class MyStreamListener(tweepy.StreamListener):
def __init__(self, api=None):
super(MyStreamListener, self).__init__()
self.num_tweets = 0
self.file = open("tweets.txt", "w")
def on_status(self, status):
tweet = status._json
self.file.write( json.dumps(tweet) + '\n' )
self.num_tweets += 1
@conormm
conormm / r-to-python-data-wrangling-basics.md
Last active August 5, 2024 16:47
R to Python: Data wrangling with dplyr and pandas

R to python data wrangling snippets

The dplyr package in R makes data wrangling significantly easier. The beauty of dplyr is that, by design, the options available are limited. Specifically, a set of key verbs form the core of the package. Using these verbs you can solve a wide range of data problems effectively in a shorter timeframe. Whilse transitioning to Python I have greatly missed the ease with which I can think through and solve problems using dplyr in R. The purpose of this document is to demonstrate how to execute the key dplyr verbs when manipulating data using Python (with the pandas package).

dplyr is organised around six key verbs:

@julionc
julionc / 00.howto_install_phantomjs.md
Last active July 8, 2024 21:44
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
@gre
gre / easing.js
Last active September 21, 2024 22:06
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See the COPYING file for more details.
*/
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {