Skip to content

Instantly share code, notes, and snippets.

View vivekfe's full-sized avatar

Vivek Srivastava vivekfe

View GitHub Profile
#include <iostream>
#include <cmath>
#include <random>
double call_option_price(double S, double K, double r, double sigma, double T) {
double S_T = S * exp((r - 0.5 * sigma * sigma) * T + sigma * sqrt(T) * randn());
return std::max(S_T - K, 0.0);
}
int main() {
#include <iostream>
#include <functional>
int catch_lambda(std::function<int(int, int)> func, int x, int y) {
return func(x, y);
}
int main()
{
int x = 5, y = 7;
auto adder = [](int a, int b) { return a + b; };
@vivekfe
vivekfe / poetry_virtual_env
Created October 8, 2022 15:04
To Create a Python Based virtual env using Poetry
- Install Poetry using curl -sSL https://install.python-poetry.org | python
- Navigate to a directory where you would like to create a virtual env along with the project
If you would like to name project 'ft'
- poetry new ft
To create a new pyproject.toml
- poetry init
// Start the MongoDB Container
docker run --name mongo -d mongo
docker exec -i mongo sh -c 'mongoimport -d oreilly -c students --drop --type json' < students.json
// Check that Mongodb adds a projection on non-used fields
db.students.explain("executionStats").aggregate( [
{ $group: { _id: "$grade", frequency: { $sum: 1 } } },
{ $match: { "frequency": { $gt : 10 } } }
Go to tools in canopy and open command prompt.
Type jupyter notebook --ip='*' --NotebookApp.token='' --NotebookApp.password=''
@vivekfe
vivekfe / MyFirstIPythonNotebook
Created December 31, 2014 18:54
MyFirstIPythonNotebook
{
"metadata": {
"name": "",
"signature": "sha256:6a0c1d9364993a07dcf9a591397af10a52e33da7391186ce55c9f7b6c2d90e56"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@vivekfe
vivekfe / 0_reuse_code.js
Created January 31, 2014 15:25
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@vivekfe
vivekfe / Toggle Using Symple Plugin
Created January 28, 2014 16:15
Toggle Using Symple Plugin
[symple_toggle title="This Is Your Toggle Title"]Etiam rhoncus accumsan elit
sed porta. Suspendisse potenti. Nullam laoreet, velit ut condimentum feugiat,
felis nibh ornare massa, quis consectetur est lacus id lorem. Etiam rhoncus
accumsan elit sed porta. Suspendisse potenti. Etiam rhoncus accumsan elit sed
porta. Suspendisse potenti.[/symple_toggle]
[symple_toggle title="This Is Your Toggle Title"]Etiam rhoncus accumsan elit
sed porta. Suspendisse potenti. Nullam laoreet, velit ut condimentum feugiat,
felis nibh ornare massa, quis consectetur est lacus id lorem. Etiam rhoncus
accumsan elit sed porta. Suspendisse potenti. Etiam rhoncus accumsan elit sed
@vivekfe
vivekfe / Symple Tab
Created January 28, 2014 16:12
Symple Tab
[symple_tabgroup]
[symple_tab title="2013"]
2013 was the great years as wordpress community got a great theme
called Twenty Thirteen and currently this blog uses Twenty Thirteen
as the parent theme and it is running great.
[/symple_tab]
[symple_tab title="2012"]
2012 was also a great year as wordpress community got a new theme
called Twenty Twelve and many popular websites use Twenty Thirteen
as their parent theme.
@vivekfe
vivekfe / Symple Accordian
Created January 28, 2014 16:08
Symple Accordian
[symple_accordion]
[symple_accordion_section title="Free Wordpress Themes"]
There are various free Wordpress themes such as Twenty Eleven,
Twenty Thirteen and Twenty Fourteen. Oh!! Did I forgot Twenty Twelve.
[/symple_accordion_section]
[symple_accordion_section title="Premium Wordpress themes"]
There are various premium and popular wordpress theme frameworks
such as Genesis and Thesis.
[/symple_accordion_section]
[/symple_accordion]