Skip to content

Instantly share code, notes, and snippets.

@multidis
multidis / video_cut.sh
Last active Aug 24, 2020
Cut a portion of video file by timestamps without re-encoding.
View video_cut.sh
## https://superuser.com/a/377407
## starting second (7) to ending timestamp (06:05:00)
ffmpeg -ss 7 -i input.mkv -to 06:05:00 -c copy output.mkv
@multidis
multidis / all_aws_lambda_modules_python.md
Created Feb 29, 2020 — forked from gene1wood/all_aws_lambda_modules_python.md
AWS Lambda function to list all available Python modules for Python 2.7 3.6 and 3.7
View all_aws_lambda_modules_python.md

This gist contains lists of modules available in

in AWS Lambda.

It also contains the code to run in Lambda to generate these lists. In addition there is a less_versbose module in the code that you can call to get a list of the top level modules installed and the version of those modules (if they contain a version

View bitmex_and_binance.py
# IMPORTS
import pandas as pd
import math
import os.path
import time
from bitmex import bitmex
from binance.client import Client
from datetime import timedelta, datetime
from dateutil import parser
from tqdm import tqdm_notebook #(Optional, used for progress-bars)
@multidis
multidis / bobp-python.md
Created Feb 27, 2019 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.
View bobp-python.md

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@multidis
multidis / Main.cs
Created Feb 15, 2018
QuantConnect Crypto GDAX CashBuyingPower SetHoldings issue
View Main.cs
// QuantConnect Crypto GDAX CashBuyingPower SetHoldings issue
using NodaTime;
namespace QuantConnect
{
public class ExampleAlgorithm : QCAlgorithm
{
private const string UnderlyingTicker = "BTCUSD";
private const string UnderlyingCoin = "BTC";
// slippage: NEED it for BTC
@multidis
multidis / R_personal_lib_fix
Created Jul 3, 2017
`$HOME/.Renviron` content to fix inability of creating personal library repository in R 3.4.1
View R_personal_lib_fix
## https://stackoverflow.com/questions/44873972/default-r-personal-library-location-is-null
R_LIBS_USER="${HOME}/R/${R_PLATFORM}-library/permanent/"
## check with `.libPaths()` in R-session.
View optim_time_memalloc_issue.jl
using Optim
## try commenting out the log in this line, Optim src/problems/univariate.jl:
## p18(x) = x <= 3.0 ? (x-2.0)^2 : 2.0###*log(x-2.0)+1.0
function frunmap(nmap::Int64, nmat::Int64)
M = randn(nmat, nmat)
# closure to parallel-apply
function fmaploc(vi)
# not doing anything here
@multidis
multidis / pmap_optim_time.jl
Created Sep 29, 2016
Timing pmap calls involving Optim.jl in Julia versions 0.4 vs. 0.5. https://github.com/JuliaOpt/Optim.jl/issues/290
View pmap_optim_time.jl
## timing pmap with Optim calls inside the function being applied
using Optim
@everywhere foptimtry(fobj::Function) = try
# fminbox local search: conjugate gradient
Optim.optimize(Optim.DifferentiableFunction(fobj), zeros(2), -10*ones(2), 10*ones(2),
Optim.Fminbox();
# outer loop: bounds barrier
iterations = 200,
# inner loop: each optimizer run
@multidis
multidis / Ledger_3_commands.dat
Created May 24, 2016 — forked from agaviria/Ledger_3_commands.dat
Collection of ledger-cli commands
View Ledger_3_commands.dat
# comments example for .dat or .ledger files
@smallexample
; This is a single line comment,
# and this,
% and this,
| and this,
* and this.
# If you have a deeply nested tree of accounts,
# it may be convenient to define an alias, for example:
@multidis
multidis / ubuntu_nodejs_install.sh
Last active Dec 23, 2015
Node.js providing `node` and `npm` commands on Ubuntu 14.04.
View ubuntu_nodejs_install.sh
# use Node.js-maintained repositories
# http://www.hostingadvice.com/how-to/install-nodejs-ubuntu-14-04/
curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install nodejs
# update npm
sudo npm install --global npm@latest
# verify
node --version