Skip to content

Instantly share code, notes, and snippets.

@tueda
tueda / FORM-source-notes.md
Last active May 2, 2023 01:20
Some personal notes for the source code of FORM: https://github.com/vermaseren/form.

Undocumented environment variables

External channels

  • FORM_PIPES

ParFORM

  • PF_LOG
  • PF_RBUFS
@tueda
tueda / auto-cherry-pick.sh
Last active April 11, 2023 10:49
Try "git cherry-pick" in a range of commits. #shell #git #cherry-pick
#!/bin/sh
#
# @file auto-cherry-pick.sh
#
# Usage:
# auto-cherry-pick.sh ref1...ref2:
#
set -eu
output=auto-cherry-pick.log
@tueda
tueda / !my-madminer-jupyter-env.md
Last active November 1, 2024 01:53
Docker image for MadGraph5_aMC@NLO + MadMiner + Jupyter. #docker #python #jupyter

my-madminer-jupyter-env

  • Docker is required.
  • NVIDIA Container Toolkit is required to use GPU. See this.

Usage:

git clone https://gist.github.com/ac4a004de14b34e4e746e6412cf70249.git my-madminer-jupyter-env
@tueda
tueda / MakeRationalApproximation.wls
Created March 22, 2023 08:37
FORM procedure to approximates some zeta values by rational numbers. #form
chunkifyString[s_String, n_Integer] :=
StringJoin @@@ Partition[Characters[s], UpTo[n]];
writeRationalApproximation[
stream_, x_, n_, width_:72
] := Module[{s, lines, i},
s = Rationalize[x, Abs[x * 10^(-n)]] // InputForm // ToString;
lines = chunkifyString[s, width - 1];
Do[
s = lines[[i]];
@tueda
tueda / $colab_cache.md
Last active August 21, 2023 10:01
Cache on drive for Google colaboratory. #python #colab #cache
!pip install git+https://gist.github.com/tueda/ec0181f0f4c8961d49dc659f79cbfd4a

from google.colab import drive
drive.mount('/content/drive')

import colab_cache

cache = colab_cache.Cache('hello-2.12.1')
if cache.exists():
@tueda
tueda / run-mg5_aMC.sh
Last active March 14, 2023 06:16
Run MadGraph5_aMC@NLO.
#!/bin/bash
#
# @file run-mg5_aMC.sh
#
# Runs MadGraph5_aMC@NLO. This script downloads and
# sets up MadGraph5_aMC@NLO if needed.
#
set -eu
set -o pipefail
@tueda
tueda / lhapdf-colab.ipynb
Last active June 21, 2023 06:49
lhapdf-colab.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

MicrOMEGAs 5.3.35 on Homebrew/CentOS7

In short, change compilers and flags in CalcHEP_src/FlagsForSh:

CC="gcc-12"
CFLAGS="-g -O2 -fcommon -fsigned-char -std=gnu99 -fPIC"

FC="gfortran-12"
FFLAGS="-g -O2 -fno-automatic"
@tueda
tueda / !TensorFlow-patch-README.md
Last active August 10, 2022 16:58
Workaround for a TensorFlow 2.4.4 build error on old machines.

TensorFlow 2.4.4 build error on an old machine (CentOS6, Xeon X5690):

ERROR: An error occurred during the fetch of repository 'local_execution_config_python':
   Traceback (most recent call last):
        File "/home/tueda/build/tensorflow/third_party/py/python_configure.bzl", line 209
                _check_python_bin(<2 more arguments>)
        File "/home/tueda/build/tensorflow/third_party/py/python_configure.bzl", line 143, in _check_python_bin
                get_bash_bin(repository_ctx)
        File "/home/tueda/build/tensorflow/third_party/remote_config/common.bzl", line 75, in get_bash_bin
                which(repository_ctx, "bash")
@tueda
tueda / dodosuko.py
Last active August 11, 2022 15:46
「ドドスコスコスコ」が3回繰り返されたら「ラブ注入♡」する。(86文字, Wandbox: https://wandbox.org/permlink/IH3crfF7vjST9Q4B) ref.: https://twitter.com/Sheeeeepla/status/1554028833942441984 #python #code-golf #one-liner
exec(bytes('牦浯爠湡潤浩潰瑲ਪ㵮ਰ桷汩⁥⵮ㄲ㐸渺渽㈪㐦㤰簵慲摮湩⡴ⰰ⤱瀻楲瑮✨苣覃苣覃嬧♮㨱㈺ⱝ湥㵤✧਩牰湩⡴ꦃ菣ꢳ藥ꆙ⤧','u16')[2:])