Skip to content

Instantly share code, notes, and snippets.

View Sanyambansal76's full-sized avatar
🎯
Focusing

Sanyam Bansal Sanyambansal76

🎯
Focusing
View GitHub Profile
@Sanyambansal76
Sanyambansal76 / FundMe.Sol
Last active March 1, 2022 11:57
First Smart Contract - SimpleContract and StorageFactory Example
// SPDX-License-Identifier: MIT
// Smart contract that lets anyone deposit ETH into the contract
// Only the owner of the contract can withdraw the ETH
pragma solidity >=0.6.6 <0.9.0;
// Get the latest ETH/USD price from chainlink price feed
import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";
import "@chainlink/contracts/src/v0.6/vendor/SafeMathChainlink.sol";
@Sanyambansal76
Sanyambansal76 / stop_loss.py
Last active September 13, 2020 10:48
Trailing Stop Loss Order - Quantconnect - BootCamp
class BootCampTask(QCAlgorithm):
# Order ticket for our stop order, Datetime when stop order was last hit
stopMarketTicket = None
stopMarketOrderFillTime = datetime.min
highestSPYPrice = -1
def Initialize(self):
self.SetStartDate(2018, 12, 1)
self.SetEndDate(2018, 12, 10)
{"SOCIAL_HANDLE":"robertseaman","FIRST_NAME":"Robert","DATE_OF_BIRTH":"4/8/1980","ADDR_STATE":"LA","ADDR_POSTAL_CODE":"71232","SSN_NUMBER":"053-39-12313","ENTITY_TYPE":"TEST","GENDER":"M","srccode":"MDMPER","CC_ACCOUNT_NUMBER":"55342022087733443","RECORD_ID":"123123125","DSRC_ACTION":"A","ADDR_CITY":"Delhi","DRIVERS_LICENSE_STATE":"DE","PHONE_NUMBER":"225-671-0796","NAME_LAST":"SEAMAN","entityid":"284430033443","ADDR_LINE1":"772 Armstrong RD"}
sudo apt-get install wget ca-certificates
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
sudo apt-get update
sudp apt-get install postgresql-client-11
@Sanyambansal76
Sanyambansal76 / local_settings.py
Created October 8, 2018 13:51 — forked from rochacbruno/local_settings.py
Django Profiling Middleware with hotshot or Cprofile
MIDDLEWARE_CLASSES = MIDDLEWARE_CLASSES + (
'yourapp.middleware.ProfileMiddleware',
'yourapp.middleware.CProfileMiddleware'
)
https://ccm.net/faq/3505-repair-file-system-errors-on-ubuntu
@Sanyambansal76
Sanyambansal76 / speed_test.py
Created September 2, 2018 13:35
Linux Speed Test command line
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2012-2018 Matt Martz
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@Sanyambansal76
Sanyambansal76 / install_docker.sh
Last active March 7, 2019 13:40
Install docker and docker compose ubuntu16.04
#!/usr/bin/env bash
# install docker
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install -y docker-ce
sudo usermod -aG docker ${USER}
su - ${USER}
id -nG
echo "Now Enter you password"
@Sanyambansal76
Sanyambansal76 / sql_replace_in_django_orm.py
Created May 1, 2018 10:17 — forked from simonw/sql_replace_in_django_orm.py
How to use the SQL replace function in a Django ORM query
from django.db.models import F, Func, Value
from myapp.models import MyModel
# Annotation
MyModel.objects.filter(description__icontains='\r\n').annotate(
fixed_description=Func(
F('description'),
Value('\r\n'), Value('\n'),
function='replace',
)
@Sanyambansal76
Sanyambansal76 / Order Book Gdax
Created August 9, 2017 14:11
List contains 3 index [ price, size, num-orders ]
{
u'bids': [
[
u'3272.07',
u'0.10051789',
1
],
[
u'3270.8',
u'3.55364293',