Skip to content

Instantly share code, notes, and snippets.

View cpoptic's full-sized avatar

Cpop cpoptic

View GitHub Profile
# Execute an order. Must contain 5, 6, or 7 arguments: type, symbol,
# quantity, side, time in force, limit price (optional), and stop price
# (optional).
@app.route("/order", methods=["POST"])
def order_handler():
args = request.form.get("text").split(" ")
if(len(args) == 0):
return WRONG_NUM_ARGS
@JustinGrote
JustinGrote / profile.ps1
Last active August 26, 2022 08:50
VSCode Default Dark+ Terminal Theme (VSCode Settings, Windows Terminal profiles.json, PSReadline profile.ps1)
#PSReadline theme to match VSCode editor colors
if ($env:TERM_PROGRAM -eq 'VSCode' -or $env:WT_SESSION) {
if ($psedition -eq 'core') {
$ansiesc = "`e"
} else {
$ansiesc = [char]0x1b
}
Set-PSReadlineOption -Colors @{
Command = "$($ansiesc)[93m"
@imadelh
imadelh / mydocker.sh
Last active June 19, 2022 15:28
Nvidia Docker - Jetson Nano
#!/bin/bash
# Copied and modified from https://github.com/Technica-Corporation/Tegra-Docker
# Copyright (c) 2017, Technica Corporation. All rights reserved.
NV_LIBS="/usr/lib/aarch64-linux-gnu \
/usr/local/cuda/lib64 \
/usr/local/cuda \
/usr/src/tensorrt \
/usr/local/cuda-10.0 \
/usr/include \
@thomwolf
thomwolf / pytorch_training.py
Last active December 18, 2019 07:20
A simple PyTorch training loop
predictions = model(inputs) # Forward pass
loss = loss_function(predictions, labels) # Compute loss function
loss.backward() # Backward pass
optimizer.step() # Optimizer step
predictions = model(inputs) # Forward pass with new parameters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kauffmanes
kauffmanes / install_anaconda.md
Last active June 7, 2024 23:06
Install Anaconda on Windows Subsystem for Linux (WSL)

Thanks everyone for commenting/contributing! I made this in college for a class and I no longer really use the technology. I encourage you all to help each other, but I probably won't be answering questions anymore.

This article is also on my blog: https://emilykauffman.com/blog/install-anaconda-on-wsl

Note: $ denotes the start of a command. Don't actually type this.

Steps to Install Anaconda on Windows Ubuntu Terminal

  1. Install WSL (Ubuntu for Windows - can be found in Windows Store). I recommend the latest version (I'm using 18.04) because there are some bugs they worked out during 14/16 (microsoft/WSL#785)
  2. Go to https://repo.continuum.io/archive to find the list of Anaconda releases
  3. Select the release you want. I have a 64-bit computer, so I chose the latest release ending in x86_64.sh. If I had a 32-bit computer, I'd select the x86.sh version. If you accidentally try to install the wrong one, you'll get a warning in the terminal. I chose `Anaconda3-5.2.0-Li
@renevo
renevo / go-wsl.md
Created September 5, 2018 18:56
Easily update/install Go in wsl

Updating/Installing Go in WSL

Remove

Removes older versions

sudo rm -rf /usr/local/go* && sudo rm -rf /usr/local/go
@andrewjong
andrewjong / pytorch_image_folder_with_file_paths.py
Last active February 27, 2024 09:24
PyTorch Image File Paths With Dataset Dataloader
import torch
from torchvision import datasets
class ImageFolderWithPaths(datasets.ImageFolder):
"""Custom dataset that includes image file paths. Extends
torchvision.datasets.ImageFolder
"""
# override the __getitem__ method. this is the method that dataloader calls
def __getitem__(self, index):
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from btgym import BTgymEnv
import IPython.display as Display
import PIL.Image as Image
from gym import spaces
import gym
import numpy as np
import random