Skip to content

Instantly share code, notes, and snippets.

Risk Parity & Budgeting

With Python

Dr. Yves J. Hilpisch | The Python Quants & The AI Machine

Python for Quant Finance Meetup, London, 16. November 2022

(short link to this Gist: http://bit.ly/pqf_risk)

@rickd-uk
rickd-uk / beautiful_spinner.sh
Created March 15, 2021 02:34
BASH - BEAUTIFUL SPINNER
**COMPLEX SPINNER**
#!/bin/bash
#Shows a spinner while another command is running. Randomly picks one of 12 spinner styles.
#@args command to run (with any parameters) while showing a spinner.
#E.g. ‹spinner sleep 10›
function shutdown() {
tput cnorm # reset cursor
}
trap shutdown EXIT
@vivkin
vivkin / 16-color-table.sh
Created May 26, 2017 07:11
Terminal color test scripts
#!/bin/bash
#
# This file echoes a bunch of color codes to the terminal to demonstrate
# what's available. Each line is the color code of one forground color,
# out of 17 (default + 16 escapes), followed by a test use of that color
# on all nine background colors (default + 8 escapes).
#
T='gYw' # The test text
echo -e "\n 40m 41m 42m 43m 44m 45m 46m 47m";
for FGs in ' m' ' 1m' ' 30m' '1;30m' ' 31m' '1;31m' ' 32m' '1;32m' ' 33m' '1;33m' ' 34m' '1;34m' ' 35m' '1;35m' ' 36m' '1;36m' ' 37m' '1;37m';
@qt-kaneko
qt-kaneko / Program.cs
Last active May 8, 2024 12:02
Google Lens API POC
using System;
using System.Linq;
using System.Net.Http;
using System.Text.Json;
using System.Text.RegularExpressions;
var http = new HttpClient();
// Here is image, i.e. File.ReadAllBytes("smth.png");
var file = new byte[] {137, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, 0, 0, 0, 44, 0, 0, 0, 44, 8, 6, 0, 0, 0, 30, 132, 90, 1, 0, 0, 0, 9, 112, 72, 89, 115, 0, 0, 11, 19, 0, 0, 11, 19, 1, 0, 154, 156, 24, 0, 0, 5, 194, 105, 84, 88, 116, 88, 77, 76, 58, 99, 111, 109, 46, 97, 100, 111, 98, 101, 46, 120, 109, 112, 0, 0, 0, 0, 0, 60, 63, 120, 112, 97, 99, 107, 101, 116, 32, 98, 101, 103, 105, 110, 61, 34, 239, 187, 191, 34, 32, 105, 100, 61, 34, 87, 53, 77, 48, 77, 112, 67, 101, 104, 105, 72, 122, 114, 101, 83, 122, 78, 84, 99, 122, 107, 99, 57, 100, 34, 63, 62, 32, 60, 120, 58, 120, 109, 112, 109, 101, 116, 97, 32, 120, 109, 108, 110, 115, 58, 120, 61, 34, 97, 100, 111, 98, 101, 58, 110, 115, 58, 109, 101, 116, 97, 47, 34, 32, 120, 58, 120, 109, 112, 116, 107, 61, 34, 65, 100, 111, 98, 101, 32, 88,
@HelBorn
HelBorn / Startup.cs
Created March 31, 2012 15:33
Adding a program to startup in C#
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
namespace RunOnStartup
{
/// <summary>
/// It attempts to write to HKEY_LOCAL_MACHINE first, which will run on startup on all user accounts.
@danpawlik
danpawlik / Setup-GSI-Image.md
Last active May 8, 2024 11:59
Flashing GSI on Xiaomi Mi 11T Pro (vili) treble phhusson

Installation

Steps:

With computer

  1. Unlock bootloader
  2. sudo fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img (stock or google)
  3. sudo fastboot erase system
  4. sudo fastboot flash system Gsi.img
  5. If you have an error in step 5 "not enough space to resize partition": sudo fastboot delete-logical-partition product_b (if fastboot getvar all "current-slot" is a, run: sudo fastboot delete-logical-partition product_a - https://www.droidwin.com/fix-failed-remote-not-enough-space-to-resize-partition/)
@wojteklu
wojteklu / clean_code.md
Last active May 8, 2024 11:58
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

@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 8, 2024 11:55
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@mowings
mowings / cron_docker.md
Last active May 8, 2024 11:54
Run cron on docker with job output directed to stdout

You'd like a docker container that runs cron jobs, with the output of those cron jobs going to stdout so they are accessible as docker logs. How do you do that?

Install cron, and set it up to run in the foreground

In your Dockerfile, apt-get -y install cron Use apk or whatever if you are running on alpine or another distribution Set the command or entrypoint in your Dockerfile to run cron 9n the foreground

ENTRYPOINT ["/usr/sbin/cron", "-f"]
@juniz-dm
juniz-dm / group copy.ps1
Created May 8, 2024 11:54 — forked from guyinacube/group copy.ps1
Create mail enabled security group based on O365 Unified group
## Option 1 - This can be used to be prompted for credentials
$UserCredential = Get-Credential
## Option 2 - If you really want to automate the script, you will
## want to hard code the credentials to log into Azure AD.
# $User = "<ADMIN USER>"
# $PWord = ConvertTo-SecureString -String "<PASSWORD>" -AsPlainText -Force
# $UserCredential = New-Object -TypeName "System.Management.Automation.PSCredential" -ArgumentList $User, $PWord
## Create the session to Exchange Online