This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import scipy | |
import traceback as tb | |
def latexnum(n, num_decimals=6): | |
s = "%.*g" % (num_decimals, n) | |
s = s.replace('e+', '\\cdot 10^{') | |
s = s.replace('e-', '\\cdot 10^{-') | |
if '{' in s: s += '}' | |
s = s.replace('.', '{,}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Word-wrapping code from Simon’s Quest Multilingual Retranslation project | |
* Copyright © 2020 Joel Yliluoma — https://iki.fi/bisqwit/cv2fin/ | |
*/ | |
class WordWrapState | |
{ | |
// Output state | |
var $x=0,$y=0, $outcome=''; | |
// Input state |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <utility> | |
/* https://godbolt.org/z/9ic5bL | |
A child couldn’t sleep, so her mother told a story about a little frog, | |
who couldn’t sleep, so the little frog’s mother told a story about a little bear, | |
who couldn’t sleep, so the little bear’s mother told a story about a little weasel | |
— who fell asleep; | |
… and the little bear fell asleep; | |
… and the little frog fell asleep; | |
… and the child fell asleep. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* THIS SCRIPT EDITS *ALL* YOUTUBE VIDEOS BELONGING TO THE AUTHENTICATED USER, | |
* AND REPLACES http:// LINKS WITH https:// LINKS IN THE VIDEO DESCRIPTION. | |
* ONLY LINKS MATCHING A WHITELIST ARE MODIFIED (see preg_replace below). | |
* Copyright © 2018 Joel Yliluoma — https://iki.fi/bisqwit/ | |
* License: MIT | |
*/ | |
/* Note: You will need to create OAuth credentials at: https://console.developers.google.com/apis/credentials |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <unordered_map> | |
#include <type_traits> | |
#include <queue> | |
#include <vector> | |
#include <algorithm> | |
#include <optional> | |
/** | |
* \fn Dijkstra<DistanceType,NodeType>(firstnode, lastnode, for_all_neighbors_of, return_route) | |
* \brief Searches for the shortest route between nodes `firstnode` and `lastnode`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// RGB to YUV conversion matrix | |
#define LUMA_COEFFICIENTS 0.29900, 0.58700, 0.11400 | |
#define CHROMA1_COEFFICIENTS -0.14713, -0.28886, 0.43600 | |
#define CHROMA2_COEFFICIENTS 0.61500, -0.51499, -0.10001 | |
// YUV to RGB conversion matrix | |
#define R_YUV_COEFFICIENTS 1, 0.00000, 1.13983 | |
#define G_YUV_COEFFICIENTS 1, -0.39465, -0.58060 | |
#define B_YUV_COEFFICIENTS 1, 2.03211, 0.00000 | |
template<typename VecType> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ "$color_prompt" = yes ]; then | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' | |
else | |
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
#include <cmath> | |
#include <cstdlib> | |
#include <ctime> | |
#include <unistd.h> | |
#include <cstdio> | |
using namespace std; | |
/* saturation, value and hue all are 0..1 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
#include <vector> | |
#include <algorithm> | |
/* textbox: Abstraction for 2-dimensional text strings, with VT100 linedrawing support */ | |
/* Copyright (c) 2017 Joel Yliluoma - http://iki.fi/bisqwit/ */ | |
/* License: MIT */ | |
/* Requires a C++17 capable compiler and standard library. */ | |
struct textbox | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <memory> | |
#include <iterator> | |
#include <typeindex> | |
/* Tiny transform_iterator for C++. Copyright 2018 © Joel Yliluoma - http://iki.fi/bisqwit/ | |
* License: MIT | |
Example WITHOUT transform_iterator: | |
template<typename Func> |
NewerOlder