Skip to content

Instantly share code, notes, and snippets.

@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
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:])
@tueda
tueda / music21-colab.ipynb
Last active July 26, 2022 05:56
How to set up music21 on Google Colaboratory with MuseScore 3.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tueda
tueda / tetris.py
Last active April 1, 2024 03:15
A simple tetris-ish game in Python with the curses library. #python #game #curses
# テトリスもどき(Replitのコンソールで動作する)
# 左/右/下: 移動
# (半角)スペース: 回転
import curses
import random
import time
def main(stdscr):
@tueda
tueda / FootnoteExample.ipynb
Last active May 23, 2024 14:27
Jupyter Notebook Footnote example. This also works with Google Colaboratory.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
(*
PolynomialDivCofficientList
Return the coefficient list by dividing polynomials;PolynomialDivCofficientList[x^2+1,x+1,x]\[LongRightArrow]{1,-2,2},which means x^2+1==(x+1)^2-2(x+1)+2.
*)
PolynomialDivCofficientList[expr_, denom_, x_] := Module[
{result, rem, cnt, i},
result = {};
rem = expr;
(*
ColorBrackets
A function that colors successive levels of bracketing differently.
*)
TransformBrackets[f_, expr_] :=
DisplayForm[FindBrackets[ToBoxes[expr // TraditionalForm], f]];
FindBrackets[startexpr_, f_] :=