Skip to content

Instantly share code, notes, and snippets.

@ultimatile
ultimatile / gdb-entitlement.xml
Last active March 10, 2024 11:09
For codesign to use gdb on macOS. This code is taken from https://sourceware.org/gdb/wiki/PermissionsDarwin. This gist is created to do wget the file.
<!--original source: https://sourceware.org/gdb/wiki/PermissionsDarwin-->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
@ultimatile
ultimatile / popup
Last active March 10, 2024 13:47
popup - A shell function to display a notification popup on macOS
#!/bin/zsh
# popup - A shell function to display a notification popup on macOS
#
# This function allows you to display a notification popup on macOS.
# It is useful for notifying users when a long-running process, such as a large build, has finished.
#
# Usage:
# popup [-M MESSAGE] [-F FAILED_MESSAGE] COMMAND
#
# Options:
@ultimatile
ultimatile / timetable.tex
Last active February 2, 2024 12:33
tabularrayで時刻表作成
\documentclass[a4paper,border={10pt 10pt 10pt 10pt}]{standalone}% A4サイズで余白を10ptに設定
\usepackage{xeCJK}% 日本語用
\usepackage{xcolor}% 着色用
\usepackage{tabularray}% テーブル作成用
% フォント指定(フォントがインストールされている必要あり)
%\setCJKmainfont{BIZ UDGothic}
\begin{document}
\begin{tblr}{% テーブル作成
stretch=2.7, % A4サイズになるようにテーブル全体を拡大
colspec={|c|*{17}{c}|}, % 18列のテーブルを作成c:中央揃え,|:縦線
@ultimatile
ultimatile / println.cpp
Created September 15, 2023 05:38
println function for C++>=17
/*
a print function with line break for standard output.
usage: println(args...)
args are variadic arguments to display.
It behaves in the same way as the following standard output format;
std::cout << args[0] << args[1] << ... << std::endl;
This fuction needs C++17.
*/
\RequirePackage[l2tabu, orthodox]{nag}
\documentclass[12pt,paper={35mm}{35mm}, xelatex, ja=standard]{bxjsarticle}
\usepackage{amsmath,amssymb,bm,amsthm}
\usepackage{amsfonts}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{float}
\usepackage{xcolor}
\usepackage{fontspec}
\setmainfont{BIZUDPGothic-Regular}
@ultimatile
ultimatile / cmake_qe.sh
Last active February 5, 2023 16:24
Building Quantum ESPRESSO by CMake
# with install
# Replace <path to QE source directory> and <path to install directory> with the appropriate paths.
cmake -S <path to QE source directory> -Bbuild -DCMAKE_C_COMPILER=mpicc -DCMAKE_Fortran_COMPILER=mpif90 -DCMAKE_INSTALL_PREFIX=<path to install directory> -DQE_ENABLE_OPENMP=ON
cmake --build build --target install
# without install
# Replace <path to QE source directory> with the appropriate path.
cmake -S <path to QE source directory> -Bbuild -DCMAKE_C_COMPILER=mpicc -DCMAKE_Fortran_COMPILER=mpif90 -DQE_ENABLE_OPENMP=ON
cmake --build build
@ultimatile
ultimatile / slide.tex
Created October 28, 2022 00:32
Beamer Template
\documentclass[unicode,10pt,aspectratio=169]{beamer}
%\usepackage{zxjatype}
%\usepackage[ipaex]{zxjafont}
%\usepackage{pxchfon}
%
% For more themes, color themes and font themes, see:
% http://deic.uab.es/~iblanes/beamer_gallery/index_by_theme.html
%
%\usepackage{zxjatype}
%\setjamainfont{YuMincho}
@ultimatile
ultimatile / subplots_vxh.py
Last active August 29, 2021 09:23
縦vnum個×横hnum個のgraphをまとめて出力するpython script
#!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
from numpy.random import randn
h = 18.4
fig = plt.figure(figsize=(h, 9 / 16 * h))
cmap = plt.get_cmap("gnuplot")
color = lambda a: cmap(float(a))
@ultimatile
ultimatile / progress.py
Last active September 8, 2021 17:14
日付-ページ数プロット. 論文の進捗管理などにどうぞ. 進捗を書き込んだprogress_.dat読み込んで表示します.
import matplotlib.pyplot as plt
import numpy as np
import datetime
from matplotlib.dates import DateFormatter
# pdfで保存するのに必要
from matplotlib.backends.backend_pdf import PdfPages
# 使用するcolormapを指定(colormapは下のurlで確認可能)
# https://matplotlib.org/tutorials/colors/colormaps.html
cmap = plt.get_cmap("brg")
using PyPlot
# https://github.com/JuliaPy/PyPlot.jl
#Fermi分布函数をmatplotlibで書いてみる
# 一般的な注意
# matplotlibはmatlab流とobject流で呼び出す函数名が変わるので注意が必要. ここで使っているのはobject流.
# 細かい調整はobject流の方ができるのでobject流をお勧めする.
# 参考文献は例えば https://qiita.com/skotaro/items/08dc0b8c5704c94eafb9
# Fermi分布函数(mu=0)