Skip to content

Instantly share code, notes, and snippets.

View jcayzac's full-sized avatar

Julien Cayzac jcayzac

View GitHub Profile
@jcayzac
jcayzac / Information Discreteness.pine
Created July 23, 2022 05:17
Information Discreteness [TradingView] [PineScript]
// Based on Da, Gurun and Warachka's 2014 paper:
// "Frog in the Pan: Continuous Information and Momentum"
// PDF: https://www3.nd.edu/~zda/Frog.pdf
//@version=5
indicator("Information Discreteness", overlay=false, precision=1, timeframe="D")
LENGTH = input.int(title="Window Length", defval=365, minval=7)
SKIP_RECENT = input.int(title="Skip most recent", defval=30, minval=0)
MA_LENGTH = input.int(title="Average returns over", defval=7, minval=1)
@jcayzac
jcayzac / using-conda-with-blender.md
Last active April 14, 2024 06:54
How to replace Blender's builtin CPython with a Miniconda-managed python

Using Blender with Miniconda

If you want to play with Blender scripting but the Python packages it ships with aren't enough, you can replace its built-in Python with your own. Here I give you some instructions to swap in a miniconda-managed environment.

These instructions apply for macOS. YMMV.

1. Install Blender

# If you don't like Homebrew you can just get it from https://www.blender.org/download/

Loading a remote SVX into a route

@jcayzac
jcayzac / On PID 1 and Containers.md
Last active September 8, 2021 09:18
Explainer for init in docker / k8s

The process identifier (a.k.a. process ID or PID) is a number used by most operating system kernels, such as those of Unix, macOS and Windows, to uniquely identify an active process.

In Unix-like operating systems, PID 1 is usually the init[^init-name] process spawned by the kernel and responsible for starting and shutting down the rest of the system.

A process can create child processes using the fork system call. At any arbitrary time, this means processes can be represented by a tree structure. For example:

─┬─ PID 1 (init)
 ├─┬─ PID 2
 │ └─┬─ PID 4

│ └─── PID 7

Companies with work-from-home policies

  • Basecamp
  • DataStax
  • DuckDuckGo
  • Etsy
  • Facebook
  • GitHub
  • GitLab
  • Moneytree 🇯🇵

This is a test1.


Footnotes

  1. A footnote.

Login Keychain & Filevault Emergency Recovery

Login as startupuser, then:

Fixing The Login Keychain

sudo bash
su - $MY_USERNAME
security set-keychain-password /Users/$MY_USERNAME/Library/Keychains/login.keychain-db

react+ts+vite+pnpm

pnpm init @vitejs/app app -- --template react-ts
cd app
pnpm install
git init && git add -A && git commit -m "initial commit"
#pnpm run build
pnpm run dev
@jcayzac
jcayzac / swift-project-build.js
Created December 7, 2020 02:03
Building Swift projects from the command line
mkdir foo && cd $_
swift package init
# 1) Add iOS target to Package.swift
# 2) Add flags for XCode in Package.xcconfig, e.g.
#
# DEVELOPMENT_TEAM = ...;
# CODE_SIGN_STYLE = Automatic;
# INFOPLIST_FILE = ...;
swift package generate-xcodeproj --xcconfig-overrides Package.xcconfig
xcodebuild build -sdk iphoneos -scheme 'foo-Package' -clonedSourcePackagesDirPath SourcePackages \
@jcayzac
jcayzac / BestFitImage.kt
Last active November 17, 2020 12:06
Image size fitting computations
data class RenderSize(val width: Int, val height: Int) {
companion object {
// 0x0 is an alias for "any"
val ANY = RenderSize(0, 0)
}
}
/**
* Scores an image resource based on the set of sizes it supports and on the
* size the caller wants to render it inside of.