Discover gists
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)
**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 |
#!/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'; |
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, |
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. |
- Unlock bootloader
sudo fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img
(stock or google)sudo fastboot erase system
sudo fastboot flash system Gsi.img
- 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/)
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.
- Follow standard conventions.
- Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
- Boy scout rule. Leave the campground cleaner than you found it.
- Always find root cause. Always look for the root cause of a problem.
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?
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"]